<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>EasyRTC Documentation</title>
  <script src="scripts/prettify/prettify.js"> </script>
  <script src="scripts/prettify/lang-css.js"> </script>
  <!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
  <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  <link href="../assets/easyrtc-docs-jsdoc-styles-1.css" media="all" rel="stylesheet" />
</head>
<body>
<header class="template">
	<div class="wrapper-content">
    <a href="../index.html"><img src="../assets/easyrtc-logo.png" alt="EasyRTC Documentation"></a>
		<h1 title="EasyRTC Documentation">Documentation</h1>
	</div>
</header>
<div class="wrapper-docs">
<nav>
	<h2><a href="../index.html">Docs Home</a></h2>
	<h3>EasyRTC Guides</h3>
	<ul>
		<li><a href="../easyrtc_faq.html">FAQ</a></li>
		<li><a href="../easyrtc_gettingStarted.html">Getting Started</a></li>
		<li><a href="../easyrtc_server_install.html">EasyRTC Server: Installation</a></li>
		<li><a href="../easyrtc_client_tutorial.html">EasyRTC Framework Tutorial</a></li>
		<li><a href="../easyrtc_rooms.html">Rooms</a></li>
		<li><a href="../easyrtc_server_configuration.html">EasyRTC Server: Configuration</a></li>
		<li><a href="../easyrtc_server_events.html">EasyRTC Server: Events</a></li>
		<li><a href="../easyrtc_server_ice.html">EasyRTC Server: ICE Configuration</a></li>
		<li><a href="../easyrtc_with_other_servers.html">Using Alongside Other Servers</a></li>
		<li><a href="../easyrtc_server_ssl.html">EasyRTC Server: Using SSL</a></li>
		<li><a href="../easyrtc_webrtc_problems.html">WebRTC Problems and Possible Fixes</a></li>
		<li><a href="../easyrtc_upcoming_features.html">Upcoming Features</a></li>
		<li><a href="../easyrtc_changelog.html">Change Log</a></li>
	</ul>
	<h3>EasyRTC Client Classes</h3>
	<ul>
		<li><a href="../client-api/Easyrtc.html">Easyrtc</a></li>
		<li><a href="../client-api/Easyrtc_App.html">Easyrtc_App</a></li>
		<li><a href="../client-api/Easyrtc_ft.html">Easyrtc_ft</a></li>
		<li><a href="../client-api/Easyrtc_IframeCapture.html">Easyrtc_IframeCapture</a></li>
		<li><a href="../client-api/Easyrtc_No_IframeCapture.html">Easyrtc_No_IframeCapture</a></li>
		<li><a href="../client-api/Easyrtc_Rates.html">Easyrtc_Rates</a></li>
		<li><a href="../client-api/Easyrtc_Recorder.html">Easyrtc_Recorder</a></li>
	</ul>
	<h3>EasyRTC Server Modules</h3>
	<ul>
		<li><a href="../server-api/module-easyrtc_default_event_listeners.html">easyrtc_default_event_listeners</a></li>
		<li><a href="../server-api/module-easyrtc_default_options.html">easyrtc_default_options</a></li>
		<li><a href="../server-api/module-easyrtc_private_obj.html">easyrtc_private_obj</a></li>
		<li><a href="../server-api/module-easyrtc_public_obj.html">easyrtc_public_obj</a></li>
		<li><a href="../server-api/module-easyrtc_util.html">easyrtc_util</a></li>
		<li><a href="../server-api/module-general_util.html">general_util</a></li>
	</ul>
	<h3>EasyRTC Server Classes</h3>
	<ul>
		<li><a href="../server-api/module-easyrtc_default_event_listeners-eventListener.html">eventListener</a></li>
		<li><a href="../server-api/module-easyrtc_public_obj-pub.html">pub</a></li>
		<li><a href="../server-api/module-easyrtc_public_obj-pub.events.html">events</a></li>
		<li><a href="../server-api/module-easyrtc_public_obj-pub.util.html">util</a></li>
		<li><a href="../server-api/module-easyrtc_util-eu.html">eu</a></li>
		<li><a href="../server-api/module-general_util-g.html">g</a></li>
		<li><a href="../server-api/pub.appObj.html">appObj</a></li>
		<li><a href="../server-api/pub.appObj.connectionObj.html">connectionObj</a></li>
		<li><a href="../server-api/pub.appObj.connectionObj.connectionRoomObj.html">connectionRoomObj</a></li>
		<li><a href="../server-api/pub.appObj.roomObj.html">roomObj</a></li>
		<li><a href="../server-api/pub.appObj.sessionObj.html">sessionObj</a></li>
	</ul>
</nav>
<div class="easyrtc-docs-content">
<div id="main">
<h1 class="page-title">Source: easyrtc_public_obj.js</h1>
<section>
<article>
<pre class="prettyprint source linenums easyrtc"><code><a name="line1"></a><div class="linenumber">1</div><div style="width:0em;display:inline-block"></div>/*&nbsp;global&nbsp;module,&nbsp;require&nbsp;*/
<a name="line2"></a><div class="linenumber">2</div><div style="width:0em;display:inline-block"></div>
<a name="line3"></a><div class="linenumber">3</div><div style="width:0em;display:inline-block"></div>/**
<a name="line4"></a><div class="linenumber">4</div><div style="width:0em;display:inline-block"></div>*&nbsp;Public&nbsp;interface&nbsp;for&nbsp;interacting&nbsp;with&nbsp;EasyRTC.&nbsp;Contains&nbsp;the&nbsp;public&nbsp;object&nbsp;returned&nbsp;by&nbsp;the&nbsp;EasyRTC&nbsp;listen()&nbsp;function.
<a name="line5"></a><div class="linenumber">5</div><div style="width:0em;display:inline-block"></div>*
<a name="line6"></a><div class="linenumber">6</div><div style="width:0em;display:inline-block"></div>*&nbsp;@module&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;easyrtc_public_obj
<a name="line7"></a><div class="linenumber">7</div><div style="width:0em;display:inline-block"></div>*&nbsp;@author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Priologic&nbsp;Software,&nbsp;info@easyrtc.com
<a name="line8"></a><div class="linenumber">8</div><div style="width:0em;display:inline-block"></div>*&nbsp;@copyright&nbsp;&nbsp;&nbsp;Copyright&nbsp;2016&nbsp;Priologic&nbsp;Software.&nbsp;All&nbsp;rights&nbsp;reserved.
<a name="line9"></a><div class="linenumber">9</div><div style="width:0em;display:inline-block"></div>*&nbsp;@license&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BSD&nbsp;v2,&nbsp;see&nbsp;LICENSE&nbsp;file&nbsp;in&nbsp;module&nbsp;root&nbsp;folder.
<a name="line10"></a><div class="linenumber">10</div><div style="width:0em;display:inline-block"></div>*/
<a name="line11"></a><div class="linenumber">11</div><div style="width:0em;display:inline-block"></div>
<a name="line12"></a><div class="linenumber">12</div><div style="width:0em;display:inline-block"></div>var&nbsp;events&nbsp;=&nbsp;require("events");
<a name="line13"></a><div class="linenumber">13</div><div style="width:0em;display:inline-block"></div>var&nbsp;async&nbsp;=&nbsp;require("async");
<a name="line14"></a><div class="linenumber">14</div><div style="width:0em;display:inline-block"></div>var&nbsp;_&nbsp;=&nbsp;require("underscore");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;General&nbsp;utility&nbsp;functions&nbsp;external&nbsp;module
<a name="line15"></a><div class="linenumber">15</div><div style="width:0em;display:inline-block"></div>var&nbsp;g&nbsp;=&nbsp;require("./general_util");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;General&nbsp;utility&nbsp;functions&nbsp;local&nbsp;module
<a name="line16"></a><div class="linenumber">16</div><div style="width:0em;display:inline-block"></div>
<a name="line17"></a><div class="linenumber">17</div><div style="width:0em;display:inline-block"></div>var&nbsp;e&nbsp;=&nbsp;require("./easyrtc_private_obj");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;EasyRTC&nbsp;private&nbsp;object
<a name="line18"></a><div class="linenumber">18</div><div style="width:0em;display:inline-block"></div>var&nbsp;eventListener&nbsp;=&nbsp;require("./easyrtc_default_event_listeners");&nbsp;//&nbsp;EasyRTC&nbsp;default&nbsp;event&nbsp;listeners
<a name="line19"></a><div class="linenumber">19</div><div style="width:0em;display:inline-block"></div>var&nbsp;eu&nbsp;=&nbsp;require("./easyrtc_util");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;EasyRTC&nbsp;utility&nbsp;functions
<a name="line20"></a><div class="linenumber">20</div><div style="width:0em;display:inline-block"></div>
<a name="line21"></a><div class="linenumber">21</div><div style="width:0em;display:inline-block"></div>/**
<a name="line22"></a><div class="linenumber">22</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;public&nbsp;object&nbsp;which&nbsp;is&nbsp;returned&nbsp;by&nbsp;the&nbsp;EasyRTC&nbsp;listen()&nbsp;function.&nbsp;Contains&nbsp;all&nbsp;public&nbsp;methods&nbsp;for&nbsp;interacting&nbsp;with&nbsp;EasyRTC&nbsp;server.
<a name="line23"></a><div class="linenumber">23</div><div style="width:0em;display:inline-block"></div>*
<a name="line24"></a><div class="linenumber">24</div><div style="width:0em;display:inline-block"></div>*&nbsp;@class
<a name="line25"></a><div class="linenumber">25</div><div style="width:0em;display:inline-block"></div>*/
<a name="line26"></a><div class="linenumber">26</div><div style="width:0em;display:inline-block"></div>var&nbsp;pub&nbsp;=&nbsp;module.exports;
<a name="line27"></a><div class="linenumber">27</div><div style="width:0em;display:inline-block"></div>
<a name="line28"></a><div class="linenumber">28</div><div style="width:0em;display:inline-block"></div>/**
<a name="line29"></a><div class="linenumber">29</div><div style="width:0em;display:inline-block"></div>*&nbsp;Alias&nbsp;for&nbsp;Socket.io&nbsp;server&nbsp;object.&nbsp;Set&nbsp;during&nbsp;Listen().
<a name="line30"></a><div class="linenumber">30</div><div style="width:0em;display:inline-block"></div>*
<a name="line31"></a><div class="linenumber">31</div><div style="width:0em;display:inline-block"></div>*&nbsp;@member&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;pub.socketServer
<a name="line32"></a><div class="linenumber">32</div><div style="width:0em;display:inline-block"></div>*&nbsp;@example&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;caption&gt;Dump&nbsp;of&nbsp;all&nbsp;Socket.IO&nbsp;clients&nbsp;to&nbsp;server&nbsp;console&lt;/caption&gt;
<a name="line33"></a><div class="linenumber">33</div><div style="width:0em;display:inline-block"></div>*&nbsp;console.log(pub.socketServer.connected);
<a name="line34"></a><div class="linenumber">34</div><div style="width:0em;display:inline-block"></div>*/
<a name="line35"></a><div class="linenumber">35</div><div style="width:0em;display:inline-block"></div>pub.socketServer&nbsp;=&nbsp;null;
<a name="line36"></a><div class="linenumber">36</div><div style="width:0em;display:inline-block"></div>
<a name="line37"></a><div class="linenumber">37</div><div style="width:0em;display:inline-block"></div>
<a name="line38"></a><div class="linenumber">38</div><div style="width:0em;display:inline-block"></div>/**
<a name="line39"></a><div class="linenumber">39</div><div style="width:0em;display:inline-block"></div>*&nbsp;Alias&nbsp;for&nbsp;Express&nbsp;app&nbsp;object.&nbsp;Set&nbsp;during&nbsp;Listen()
<a name="line40"></a><div class="linenumber">40</div><div style="width:0em;display:inline-block"></div>*
<a name="line41"></a><div class="linenumber">41</div><div style="width:0em;display:inline-block"></div>*&nbsp;@member&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;pub.httpApp
<a name="line42"></a><div class="linenumber">42</div><div style="width:0em;display:inline-block"></div>*/
<a name="line43"></a><div class="linenumber">43</div><div style="width:0em;display:inline-block"></div>pub.httpApp&nbsp;=&nbsp;null;
<a name="line44"></a><div class="linenumber">44</div><div style="width:0em;display:inline-block"></div>
<a name="line45"></a><div class="linenumber">45</div><div style="width:0em;display:inline-block"></div>
<a name="line46"></a><div class="linenumber">46</div><div style="width:0em;display:inline-block"></div>/**
<a name="line47"></a><div class="linenumber">47</div><div style="width:0em;display:inline-block"></div>*&nbsp;Sends&nbsp;an&nbsp;array&nbsp;of&nbsp;all&nbsp;application&nbsp;names&nbsp;to&nbsp;a&nbsp;callback.
<a name="line48"></a><div class="linenumber">48</div><div style="width:0em;display:inline-block"></div>*
<a name="line49"></a><div class="linenumber">49</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;{function(Error,&nbsp;Array.&lt;string&gt;)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;containing&nbsp;all&nbsp;application&nbsp;names.
<a name="line50"></a><div class="linenumber">50</div><div style="width:0em;display:inline-block"></div>*/
<a name="line51"></a><div class="linenumber">51</div><div style="width:0em;display:inline-block"></div>pub.getAppNames&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line52"></a><div class="linenumber">52</div><div style="width:2em;display:inline-block"></div>var&nbsp;appNames&nbsp;=&nbsp;[];
<a name="line53"></a><div class="linenumber">53</div><div style="width:2em;display:inline-block"></div>for&nbsp;(var&nbsp;key&nbsp;in&nbsp;e.app)&nbsp;{
<a name="line54"></a><div class="linenumber">54</div><div style="width:4em;display:inline-block"></div>appNames.push(key);
<a name="line55"></a><div class="linenumber">55</div><div style="width:2em;display:inline-block"></div>}
<a name="line56"></a><div class="linenumber">56</div><div style="width:2em;display:inline-block"></div>callback(null,&nbsp;appNames);
<a name="line57"></a><div class="linenumber">57</div><div style="width:0em;display:inline-block"></div>};
<a name="line58"></a><div class="linenumber">58</div><div style="width:0em;display:inline-block"></div>
<a name="line59"></a><div class="linenumber">59</div><div style="width:0em;display:inline-block"></div>
<a name="line60"></a><div class="linenumber">60</div><div style="width:0em;display:inline-block"></div>/**
<a name="line61"></a><div class="linenumber">61</div><div style="width:0em;display:inline-block"></div>*&nbsp;Gets&nbsp;app&nbsp;object&nbsp;for&nbsp;application&nbsp;which&nbsp;has&nbsp;an&nbsp;authenticated&nbsp;client&nbsp;with&nbsp;a&nbsp;given&nbsp;easyrtcid
<a name="line62"></a><div class="linenumber">62</div><div style="width:0em;display:inline-block"></div>*
<a name="line63"></a><div class="linenumber">63</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unique&nbsp;identifier&nbsp;for&nbsp;an&nbsp;EasyRTC&nbsp;connection.
<a name="line64"></a><div class="linenumber">64</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;application&nbsp;object
<a name="line65"></a><div class="linenumber">65</div><div style="width:0em;display:inline-block"></div>*/
<a name="line66"></a><div class="linenumber">66</div><div style="width:0em;display:inline-block"></div>pub.getAppWithEasyrtcid&nbsp;=&nbsp;function(easyrtcid,&nbsp;callback)&nbsp;{
<a name="line67"></a><div class="linenumber">67</div><div style="width:2em;display:inline-block"></div>for&nbsp;(var&nbsp;key&nbsp;in&nbsp;e.app)&nbsp;{
<a name="line68"></a><div class="linenumber">68</div><div style="width:4em;display:inline-block"></div>if&nbsp;(e.app[key].connection[easyrtcid]&nbsp;&amp;&amp;&nbsp;e.app[key].connection[easyrtcid].isAuthenticated)&nbsp;{
<a name="line69"></a><div class="linenumber">69</div><div style="width:6em;display:inline-block"></div>pub.app(key,&nbsp;callback);
<a name="line70"></a><div class="linenumber">70</div><div style="width:6em;display:inline-block"></div>return;
<a name="line71"></a><div class="linenumber">71</div><div style="width:4em;display:inline-block"></div>}
<a name="line72"></a><div class="linenumber">72</div><div style="width:2em;display:inline-block"></div>}
<a name="line73"></a><div class="linenumber">73</div><div style="width:2em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;find&nbsp;connection&nbsp;["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]");
<a name="line74"></a><div class="linenumber">74</div><div style="width:2em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Can&nbsp;not&nbsp;find&nbsp;connection&nbsp;["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]"));
<a name="line75"></a><div class="linenumber">75</div><div style="width:0em;display:inline-block"></div>};
<a name="line76"></a><div class="linenumber">76</div><div style="width:0em;display:inline-block"></div>
<a name="line77"></a><div class="linenumber">77</div><div style="width:0em;display:inline-block"></div>
<a name="line78"></a><div class="linenumber">78</div><div style="width:0em;display:inline-block"></div>/**
<a name="line79"></a><div class="linenumber">79</div><div style="width:0em;display:inline-block"></div>*&nbsp;Sends&nbsp;the&nbsp;count&nbsp;of&nbsp;the&nbsp;number&nbsp;of&nbsp;connections&nbsp;to&nbsp;the&nbsp;server&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.
<a name="line80"></a><div class="linenumber">80</div><div style="width:0em;display:inline-block"></div>*
<a name="line81"></a><div class="linenumber">81</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Number)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;containing&nbsp;all&nbsp;easyrtcids.
<a name="line82"></a><div class="linenumber">82</div><div style="width:0em;display:inline-block"></div>*/
<a name="line83"></a><div class="linenumber">83</div><div style="width:0em;display:inline-block"></div>pub.getConnectionCount&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line84"></a><div class="linenumber">84</div><div style="width:2em;display:inline-block"></div>callback(null,&nbsp;pub.getConnectionCountSync());
<a name="line85"></a><div class="linenumber">85</div><div style="width:0em;display:inline-block"></div>};
<a name="line86"></a><div class="linenumber">86</div><div style="width:0em;display:inline-block"></div>
<a name="line87"></a><div class="linenumber">87</div><div style="width:0em;display:inline-block"></div>
<a name="line88"></a><div class="linenumber">88</div><div style="width:0em;display:inline-block"></div>/**
<a name="line89"></a><div class="linenumber">89</div><div style="width:0em;display:inline-block"></div>*&nbsp;Sends&nbsp;the&nbsp;count&nbsp;of&nbsp;the&nbsp;number&nbsp;of&nbsp;connections&nbsp;to&nbsp;the&nbsp;server&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.
<a name="line90"></a><div class="linenumber">90</div><div style="width:0em;display:inline-block"></div>*
<a name="line91"></a><div class="linenumber">91</div><div style="width:0em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Number}&nbsp;The&nbsp;current&nbsp;number&nbsp;of&nbsp;connections&nbsp;in&nbsp;a&nbsp;room.
<a name="line92"></a><div class="linenumber">92</div><div style="width:0em;display:inline-block"></div>*/
<a name="line93"></a><div class="linenumber">93</div><div style="width:0em;display:inline-block"></div>pub.getConnectionCountSync&nbsp;=&nbsp;function()&nbsp;{
<a name="line94"></a><div class="linenumber">94</div><div style="width:2em;display:inline-block"></div>var&nbsp;connectionCount&nbsp;=&nbsp;0;
<a name="line95"></a><div class="linenumber">95</div><div style="width:2em;display:inline-block"></div>for&nbsp;(var&nbsp;key&nbsp;in&nbsp;e.app)&nbsp;{
<a name="line96"></a><div class="linenumber">96</div><div style="width:4em;display:inline-block"></div>connectionCount&nbsp;=&nbsp;connectionCount&nbsp;+&nbsp;_.size(e.app[key].connection);
<a name="line97"></a><div class="linenumber">97</div><div style="width:2em;display:inline-block"></div>}
<a name="line98"></a><div class="linenumber">98</div><div style="width:2em;display:inline-block"></div>return&nbsp;connectionCount;
<a name="line99"></a><div class="linenumber">99</div><div style="width:0em;display:inline-block"></div>};
<a name="line100"></a><div class="linenumber">100</div><div style="width:0em;display:inline-block"></div>
<a name="line101"></a><div class="linenumber">101</div><div style="width:0em;display:inline-block"></div>
<a name="line102"></a><div class="linenumber">102</div><div style="width:0em;display:inline-block"></div>/**
<a name="line103"></a><div class="linenumber">103</div><div style="width:0em;display:inline-block"></div>*&nbsp;Gets&nbsp;connection&nbsp;object&nbsp;for&nbsp;connection&nbsp;which&nbsp;has&nbsp;an&nbsp;authenticated&nbsp;client&nbsp;with&nbsp;a&nbsp;given&nbsp;easyrtcid
<a name="line104"></a><div class="linenumber">104</div><div style="width:0em;display:inline-block"></div>*
<a name="line105"></a><div class="linenumber">105</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;a&nbsp;socket&nbsp;connection.
<a name="line106"></a><div class="linenumber">106</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;connection&nbsp;object
<a name="line107"></a><div class="linenumber">107</div><div style="width:0em;display:inline-block"></div>*/
<a name="line108"></a><div class="linenumber">108</div><div style="width:0em;display:inline-block"></div>pub.getConnectionWithEasyrtcid&nbsp;=&nbsp;function(easyrtcid,&nbsp;callback)&nbsp;{
<a name="line109"></a><div class="linenumber">109</div><div style="width:2em;display:inline-block"></div>for&nbsp;(var&nbsp;key&nbsp;in&nbsp;e.app)&nbsp;{
<a name="line110"></a><div class="linenumber">110</div><div style="width:4em;display:inline-block"></div>if&nbsp;(e.app[key].connection[easyrtcid]&nbsp;&amp;&amp;&nbsp;e.app[key].connection[easyrtcid].isAuthenticated)&nbsp;{
<a name="line111"></a><div class="linenumber">111</div><div style="width:6em;display:inline-block"></div>pub.app(key,&nbsp;function(err,&nbsp;appObj)&nbsp;{
<a name="line112"></a><div class="linenumber">112</div><div style="width:8em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line113"></a><div class="linenumber">113</div><div style="width:10em;display:inline-block"></div>callback(err);
<a name="line114"></a><div class="linenumber">114</div><div style="width:10em;display:inline-block"></div>return;
<a name="line115"></a><div class="linenumber">115</div><div style="width:8em;display:inline-block"></div>}
<a name="line116"></a><div class="linenumber">116</div><div style="width:8em;display:inline-block"></div>appObj.connection(easyrtcid,&nbsp;callback);
<a name="line117"></a><div class="linenumber">117</div><div style="width:6em;display:inline-block"></div>});
<a name="line118"></a><div class="linenumber">118</div><div style="width:6em;display:inline-block"></div>return;
<a name="line119"></a><div class="linenumber">119</div><div style="width:4em;display:inline-block"></div>}
<a name="line120"></a><div class="linenumber">120</div><div style="width:2em;display:inline-block"></div>}
<a name="line121"></a><div class="linenumber">121</div><div style="width:2em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;find&nbsp;connection&nbsp;["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]");
<a name="line122"></a><div class="linenumber">122</div><div style="width:2em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Can&nbsp;not&nbsp;find&nbsp;connection&nbsp;["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]"));
<a name="line123"></a><div class="linenumber">123</div><div style="width:0em;display:inline-block"></div>};
<a name="line124"></a><div class="linenumber">124</div><div style="width:0em;display:inline-block"></div>
<a name="line125"></a><div class="linenumber">125</div><div style="width:0em;display:inline-block"></div>
<a name="line126"></a><div class="linenumber">126</div><div style="width:0em;display:inline-block"></div>/**
<a name="line127"></a><div class="linenumber">127</div><div style="width:0em;display:inline-block"></div>*&nbsp;Gets&nbsp;individual&nbsp;option&nbsp;value.&nbsp;The&nbsp;option&nbsp;value&nbsp;returned&nbsp;is&nbsp;for&nbsp;the&nbsp;server&nbsp;level.
<a name="line128"></a><div class="linenumber">128</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line129"></a><div class="linenumber">129</div><div style="width:0em;display:inline-block"></div>*&nbsp;Note&nbsp;that&nbsp;some&nbsp;options&nbsp;can&nbsp;be&nbsp;set&nbsp;at&nbsp;the&nbsp;application&nbsp;or&nbsp;room&nbsp;level.&nbsp;If&nbsp;an&nbsp;option&nbsp;has&nbsp;not&nbsp;been&nbsp;set&nbsp;at&nbsp;the&nbsp;room&nbsp;level,&nbsp;it&nbsp;will&nbsp;check&nbsp;to&nbsp;see&nbsp;if&nbsp;it&nbsp;has&nbsp;been&nbsp;set&nbsp;at&nbsp;the&nbsp;application&nbsp;level,&nbsp;if&nbsp;not&nbsp;it&nbsp;will&nbsp;revert&nbsp;to&nbsp;the&nbsp;server&nbsp;level.
<a name="line130"></a><div class="linenumber">130</div><div style="width:0em;display:inline-block"></div>*
<a name="line131"></a><div class="linenumber">131</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;&nbsp;&nbsp;&nbsp;optionName&nbsp;&nbsp;Option&nbsp;name
<a name="line132"></a><div class="linenumber">132</div><div style="width:0em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{*}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Option&nbsp;value&nbsp;(can&nbsp;be&nbsp;any&nbsp;JSON&nbsp;type)
<a name="line133"></a><div class="linenumber">133</div><div style="width:0em;display:inline-block"></div>*/
<a name="line134"></a><div class="linenumber">134</div><div style="width:0em;display:inline-block"></div>pub.getOption&nbsp;=&nbsp;function(optionName)&nbsp;{
<a name="line135"></a><div class="linenumber">135</div><div style="width:2em;display:inline-block"></div>if(typeof&nbsp;e.option[optionName]&nbsp;===&nbsp;"undefined"){
<a name="line136"></a><div class="linenumber">136</div><div style="width:4em;display:inline-block"></div>pub.util.logError("Unknown&nbsp;option&nbsp;requested.&nbsp;Unrecognised&nbsp;option&nbsp;name&nbsp;'"&nbsp;+&nbsp;optionName&nbsp;+&nbsp;"'.");
<a name="line137"></a><div class="linenumber">137</div><div style="width:4em;display:inline-block"></div>return&nbsp;null;
<a name="line138"></a><div class="linenumber">138</div><div style="width:2em;display:inline-block"></div>}
<a name="line139"></a><div class="linenumber">139</div><div style="width:2em;display:inline-block"></div>return&nbsp;e.option[optionName];
<a name="line140"></a><div class="linenumber">140</div><div style="width:0em;display:inline-block"></div>};
<a name="line141"></a><div class="linenumber">141</div><div style="width:0em;display:inline-block"></div>
<a name="line142"></a><div class="linenumber">142</div><div style="width:0em;display:inline-block"></div>
<a name="line143"></a><div class="linenumber">143</div><div style="width:0em;display:inline-block"></div>/**
<a name="line144"></a><div class="linenumber">144</div><div style="width:0em;display:inline-block"></div>*&nbsp;Gets&nbsp;EasyRTC&nbsp;Version.&nbsp;The&nbsp;format&nbsp;is&nbsp;in&nbsp;a&nbsp;major.minor.patch&nbsp;format&nbsp;with&nbsp;an&nbsp;optional&nbsp;letter&nbsp;following&nbsp;denoting&nbsp;alpha&nbsp;or&nbsp;beta&nbsp;status.&nbsp;The&nbsp;version&nbsp;is&nbsp;retrieved&nbsp;from&nbsp;the&nbsp;package.json&nbsp;file&nbsp;located&nbsp;in&nbsp;the&nbsp;EasyRTC&nbsp;project&nbsp;root&nbsp;folder.
<a name="line145"></a><div class="linenumber">145</div><div style="width:0em;display:inline-block"></div>*
<a name="line146"></a><div class="linenumber">146</div><div style="width:0em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;Version
<a name="line147"></a><div class="linenumber">147</div><div style="width:0em;display:inline-block"></div>*/
<a name="line148"></a><div class="linenumber">148</div><div style="width:0em;display:inline-block"></div>pub.getVersion&nbsp;=&nbsp;function()&nbsp;{
<a name="line149"></a><div class="linenumber">149</div><div style="width:2em;display:inline-block"></div>return&nbsp;e.version;
<a name="line150"></a><div class="linenumber">150</div><div style="width:0em;display:inline-block"></div>};
<a name="line151"></a><div class="linenumber">151</div><div style="width:0em;display:inline-block"></div>
<a name="line152"></a><div class="linenumber">152</div><div style="width:0em;display:inline-block"></div>
<a name="line153"></a><div class="linenumber">153</div><div style="width:0em;display:inline-block"></div>/**
<a name="line154"></a><div class="linenumber">154</div><div style="width:0em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;EasyRTC&nbsp;private&nbsp;object&nbsp;containing&nbsp;the&nbsp;current&nbsp;state.&nbsp;This&nbsp;should&nbsp;only&nbsp;be&nbsp;used&nbsp;for&nbsp;debugging&nbsp;purposes.
<a name="line155"></a><div class="linenumber">155</div><div style="width:0em;display:inline-block"></div>*
<a name="line156"></a><div class="linenumber">156</div><div style="width:0em;display:inline-block"></div>*&nbsp;@private
<a name="line157"></a><div class="linenumber">157</div><div style="width:0em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;private&nbsp;object
<a name="line158"></a><div class="linenumber">158</div><div style="width:0em;display:inline-block"></div>*/
<a name="line159"></a><div class="linenumber">159</div><div style="width:0em;display:inline-block"></div>pub._getPrivateObj&nbsp;=&nbsp;function()&nbsp;{
<a name="line160"></a><div class="linenumber">160</div><div style="width:2em;display:inline-block"></div>return&nbsp;e;
<a name="line161"></a><div class="linenumber">161</div><div style="width:0em;display:inline-block"></div>};
<a name="line162"></a><div class="linenumber">162</div><div style="width:0em;display:inline-block"></div>
<a name="line163"></a><div class="linenumber">163</div><div style="width:0em;display:inline-block"></div>
<a name="line164"></a><div class="linenumber">164</div><div style="width:0em;display:inline-block"></div>/**
<a name="line165"></a><div class="linenumber">165</div><div style="width:0em;display:inline-block"></div>*&nbsp;Sets&nbsp;individual&nbsp;option.&nbsp;The&nbsp;option&nbsp;value&nbsp;set&nbsp;is&nbsp;for&nbsp;the&nbsp;server&nbsp;level.
<a name="line166"></a><div class="linenumber">166</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line167"></a><div class="linenumber">167</div><div style="width:0em;display:inline-block"></div>*&nbsp;Note&nbsp;that&nbsp;some&nbsp;options&nbsp;can&nbsp;be&nbsp;set&nbsp;at&nbsp;the&nbsp;application&nbsp;or&nbsp;room&nbsp;level.&nbsp;If&nbsp;an&nbsp;option&nbsp;has&nbsp;not&nbsp;been&nbsp;set&nbsp;at&nbsp;the&nbsp;room&nbsp;level,&nbsp;it&nbsp;will&nbsp;check&nbsp;to&nbsp;see&nbsp;if&nbsp;it&nbsp;has&nbsp;been&nbsp;set&nbsp;at&nbsp;the&nbsp;application&nbsp;level,&nbsp;if&nbsp;not&nbsp;it&nbsp;will&nbsp;revert&nbsp;to&nbsp;the&nbsp;server&nbsp;level.
<a name="line168"></a><div class="linenumber">168</div><div style="width:0em;display:inline-block"></div>*
<a name="line169"></a><div class="linenumber">169</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;optionName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Option&nbsp;name
<a name="line170"></a><div class="linenumber">170</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;optionValue&nbsp;&nbsp;&nbsp;&nbsp;Option&nbsp;value
<a name="line171"></a><div class="linenumber">171</div><div style="width:0em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Boolean}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true&nbsp;on&nbsp;success,&nbsp;false&nbsp;on&nbsp;failure
<a name="line172"></a><div class="linenumber">172</div><div style="width:0em;display:inline-block"></div>*/
<a name="line173"></a><div class="linenumber">173</div><div style="width:0em;display:inline-block"></div>pub.setOption&nbsp;=&nbsp;function(optionName,&nbsp;optionValue)&nbsp;{
<a name="line174"></a><div class="linenumber">174</div><div style="width:2em;display:inline-block"></div>//&nbsp;Can&nbsp;only&nbsp;set&nbsp;options&nbsp;which&nbsp;currently&nbsp;exist
<a name="line175"></a><div class="linenumber">175</div><div style="width:2em;display:inline-block"></div>if&nbsp;(typeof&nbsp;e.option[optionName]&nbsp;==&nbsp;"undefined")&nbsp;{
<a name="line176"></a><div class="linenumber">176</div><div style="width:4em;display:inline-block"></div>pub.util.logError("Error&nbsp;setting&nbsp;option.&nbsp;Unrecognised&nbsp;option&nbsp;name&nbsp;'"&nbsp;+&nbsp;optionName&nbsp;+&nbsp;"'.");
<a name="line177"></a><div class="linenumber">177</div><div style="width:4em;display:inline-block"></div>return&nbsp;false;
<a name="line178"></a><div class="linenumber">178</div><div style="width:2em;display:inline-block"></div>}
<a name="line179"></a><div class="linenumber">179</div><div style="width:0em;display:inline-block"></div>
<a name="line180"></a><div class="linenumber">180</div><div style="width:2em;display:inline-block"></div>e.option[optionName]&nbsp;=&nbsp;pub.util.deepCopy(optionValue);
<a name="line181"></a><div class="linenumber">181</div><div style="width:2em;display:inline-block"></div>return&nbsp;true;
<a name="line182"></a><div class="linenumber">182</div><div style="width:0em;display:inline-block"></div>};
<a name="line183"></a><div class="linenumber">183</div><div style="width:0em;display:inline-block"></div>
<a name="line184"></a><div class="linenumber">184</div><div style="width:0em;display:inline-block"></div>
<a name="line185"></a><div class="linenumber">185</div><div style="width:0em;display:inline-block"></div>/**
<a name="line186"></a><div class="linenumber">186</div><div style="width:0em;display:inline-block"></div>*&nbsp;EasyRTC&nbsp;Event&nbsp;handling&nbsp;object&nbsp;which&nbsp;contain&nbsp;most&nbsp;methods&nbsp;for&nbsp;interacting&nbsp;with&nbsp;EasyRTC&nbsp;events.&nbsp;For&nbsp;convenience,&nbsp;this&nbsp;class&nbsp;has&nbsp;also&nbsp;been&nbsp;attached&nbsp;to&nbsp;the&nbsp;application,&nbsp;connection,&nbsp;session,&nbsp;and&nbsp;room&nbsp;classes.
<a name="line187"></a><div class="linenumber">187</div><div style="width:0em;display:inline-block"></div>*&nbsp;@class
<a name="line188"></a><div class="linenumber">188</div><div style="width:0em;display:inline-block"></div>*/
<a name="line189"></a><div class="linenumber">189</div><div style="width:0em;display:inline-block"></div>pub.events&nbsp;=&nbsp;{};
<a name="line190"></a><div class="linenumber">190</div><div style="width:0em;display:inline-block"></div>
<a name="line191"></a><div class="linenumber">191</div><div style="width:0em;display:inline-block"></div>
<a name="line192"></a><div class="linenumber">192</div><div style="width:0em;display:inline-block"></div>/**
<a name="line193"></a><div class="linenumber">193</div><div style="width:0em;display:inline-block"></div>*&nbsp;EasyRTC&nbsp;EventEmitter.
<a name="line194"></a><div class="linenumber">194</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line195"></a><div class="linenumber">195</div><div style="width:0em;display:inline-block"></div>*&nbsp;@private
<a name="line196"></a><div class="linenumber">196</div><div style="width:0em;display:inline-block"></div>*/
<a name="line197"></a><div class="linenumber">197</div><div style="width:0em;display:inline-block"></div>pub.events._eventListener&nbsp;=&nbsp;new&nbsp;events.EventEmitter();
<a name="line198"></a><div class="linenumber">198</div><div style="width:0em;display:inline-block"></div>
<a name="line199"></a><div class="linenumber">199</div><div style="width:0em;display:inline-block"></div>
<a name="line200"></a><div class="linenumber">200</div><div style="width:0em;display:inline-block"></div>/**
<a name="line201"></a><div class="linenumber">201</div><div style="width:0em;display:inline-block"></div>*&nbsp;Expose&nbsp;event&nbsp;listener's&nbsp;emit&nbsp;function.
<a name="line202"></a><div class="linenumber">202</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line203"></a><div class="linenumber">203</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;eventName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;event&nbsp;name.
<a name="line204"></a><div class="linenumber">204</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{...*}&nbsp;eventParam&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;event&nbsp;parameters
<a name="line205"></a><div class="linenumber">205</div><div style="width:0em;display:inline-block"></div>*/
<a name="line206"></a><div class="linenumber">206</div><div style="width:0em;display:inline-block"></div>pub.events.emit&nbsp;=&nbsp;pub.events._eventListener.emit.bind(pub.events._eventListener);
<a name="line207"></a><div class="linenumber">207</div><div style="width:0em;display:inline-block"></div>
<a name="line208"></a><div class="linenumber">208</div><div style="width:0em;display:inline-block"></div>
<a name="line209"></a><div class="linenumber">209</div><div style="width:0em;display:inline-block"></div>/**
<a name="line210"></a><div class="linenumber">210</div><div style="width:0em;display:inline-block"></div>*&nbsp;Runs&nbsp;the&nbsp;default&nbsp;EasyRTC&nbsp;listener&nbsp;for&nbsp;a&nbsp;given&nbsp;event.
<a name="line211"></a><div class="linenumber">211</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line212"></a><div class="linenumber">212</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;eventName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;event&nbsp;name.
<a name="line213"></a><div class="linenumber">213</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{...*}&nbsp;eventParam&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;event&nbsp;parameters
<a name="line214"></a><div class="linenumber">214</div><div style="width:0em;display:inline-block"></div>*/
<a name="line215"></a><div class="linenumber">215</div><div style="width:0em;display:inline-block"></div>pub.events.emitDefault&nbsp;=&nbsp;function()&nbsp;{
<a name="line216"></a><div class="linenumber">216</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!pub.events.defaultListeners[arguments['0']])&nbsp;{
<a name="line217"></a><div class="linenumber">217</div><div style="width:4em;display:inline-block"></div>console.error("Error&nbsp;emitting&nbsp;listener.&nbsp;No&nbsp;default&nbsp;for&nbsp;event&nbsp;'"&nbsp;+&nbsp;arguments['0']&nbsp;+&nbsp;"'&nbsp;exists.");
<a name="line218"></a><div class="linenumber">218</div><div style="width:4em;display:inline-block"></div>return;
<a name="line219"></a><div class="linenumber">219</div><div style="width:2em;display:inline-block"></div>}
<a name="line220"></a><div class="linenumber">220</div><div style="width:2em;display:inline-block"></div>pub.events.defaultListeners[Array.prototype.shift.call(arguments)].apply(this,&nbsp;arguments);
<a name="line221"></a><div class="linenumber">221</div><div style="width:0em;display:inline-block"></div>};
<a name="line222"></a><div class="linenumber">222</div><div style="width:0em;display:inline-block"></div>
<a name="line223"></a><div class="linenumber">223</div><div style="width:0em;display:inline-block"></div>
<a name="line224"></a><div class="linenumber">224</div><div style="width:0em;display:inline-block"></div>/**
<a name="line225"></a><div class="linenumber">225</div><div style="width:0em;display:inline-block"></div>*&nbsp;Resets&nbsp;the&nbsp;listener&nbsp;for&nbsp;a&nbsp;given&nbsp;event&nbsp;to&nbsp;the&nbsp;default&nbsp;listener.&nbsp;Removes&nbsp;other&nbsp;listeners.
<a name="line226"></a><div class="linenumber">226</div><div style="width:0em;display:inline-block"></div>*
<a name="line227"></a><div class="linenumber">227</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;eventName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;event&nbsp;name.
<a name="line228"></a><div class="linenumber">228</div><div style="width:0em;display:inline-block"></div>*/
<a name="line229"></a><div class="linenumber">229</div><div style="width:0em;display:inline-block"></div>pub.events.setDefaultListener&nbsp;=&nbsp;function(eventName)&nbsp;{
<a name="line230"></a><div class="linenumber">230</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isFunction(pub.events.defaultListeners[eventName]))&nbsp;{
<a name="line231"></a><div class="linenumber">231</div><div style="width:4em;display:inline-block"></div>console.error("Error&nbsp;setting&nbsp;default&nbsp;listener.&nbsp;No&nbsp;default&nbsp;for&nbsp;event&nbsp;'"&nbsp;+&nbsp;eventName&nbsp;+&nbsp;"'&nbsp;exists.");
<a name="line232"></a><div class="linenumber">232</div><div style="width:2em;display:inline-block"></div>}
<a name="line233"></a><div class="linenumber">233</div><div style="width:2em;display:inline-block"></div>pub.events._eventListener.removeAllListeners(eventName);
<a name="line234"></a><div class="linenumber">234</div><div style="width:2em;display:inline-block"></div>pub.events._eventListener.on(eventName,&nbsp;pub.events.defaultListeners[eventName]);
<a name="line235"></a><div class="linenumber">235</div><div style="width:0em;display:inline-block"></div>};
<a name="line236"></a><div class="linenumber">236</div><div style="width:0em;display:inline-block"></div>
<a name="line237"></a><div class="linenumber">237</div><div style="width:0em;display:inline-block"></div>
<a name="line238"></a><div class="linenumber">238</div><div style="width:0em;display:inline-block"></div>/**
<a name="line239"></a><div class="linenumber">239</div><div style="width:0em;display:inline-block"></div>*&nbsp;Resets&nbsp;the&nbsp;listener&nbsp;for&nbsp;all&nbsp;EasyRTC&nbsp;events&nbsp;to&nbsp;the&nbsp;default&nbsp;listeners.&nbsp;Removes&nbsp;all&nbsp;other&nbsp;listeners.
<a name="line240"></a><div class="linenumber">240</div><div style="width:0em;display:inline-block"></div>*/
<a name="line241"></a><div class="linenumber">241</div><div style="width:0em;display:inline-block"></div>pub.events.setDefaultListeners&nbsp;=&nbsp;function()&nbsp;{
<a name="line242"></a><div class="linenumber">242</div><div style="width:2em;display:inline-block"></div>pub.events._eventListener.removeAllListeners();
<a name="line243"></a><div class="linenumber">243</div><div style="width:2em;display:inline-block"></div>for&nbsp;(var&nbsp;currentEventName&nbsp;in&nbsp;pub.events.defaultListeners)&nbsp;{
<a name="line244"></a><div class="linenumber">244</div><div style="width:4em;display:inline-block"></div>if&nbsp;(_.isFunction(pub.events.defaultListeners[currentEventName]))&nbsp;{
<a name="line245"></a><div class="linenumber">245</div><div style="width:6em;display:inline-block"></div>pub.events._eventListener.on(currentEventName,&nbsp;pub.events.defaultListeners[currentEventName]);
<a name="line246"></a><div class="linenumber">246</div><div style="width:4em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line247"></a><div class="linenumber">247</div><div style="width:6em;display:inline-block"></div>throw&nbsp;new&nbsp;pub.util.ServerError("Error&nbsp;setting&nbsp;default&nbsp;listener.&nbsp;No&nbsp;default&nbsp;for&nbsp;event&nbsp;'"&nbsp;+&nbsp;currentEventName&nbsp;+&nbsp;"'&nbsp;exists.");
<a name="line248"></a><div class="linenumber">248</div><div style="width:4em;display:inline-block"></div>}
<a name="line249"></a><div class="linenumber">249</div><div style="width:2em;display:inline-block"></div>}
<a name="line250"></a><div class="linenumber">250</div><div style="width:0em;display:inline-block"></div>};
<a name="line251"></a><div class="linenumber">251</div><div style="width:0em;display:inline-block"></div>
<a name="line252"></a><div class="linenumber">252</div><div style="width:0em;display:inline-block"></div>
<a name="line253"></a><div class="linenumber">253</div><div style="width:0em;display:inline-block"></div>/**
<a name="line254"></a><div class="linenumber">254</div><div style="width:0em;display:inline-block"></div>*&nbsp;Map&nbsp;of&nbsp;EasyRTC&nbsp;event&nbsp;listener&nbsp;names&nbsp;to&nbsp;their&nbsp;default&nbsp;functions.&nbsp;This&nbsp;map&nbsp;can&nbsp;be&nbsp;used&nbsp;to&nbsp;run&nbsp;a&nbsp;default&nbsp;function&nbsp;manually.
<a name="line255"></a><div class="linenumber">255</div><div style="width:0em;display:inline-block"></div>*/
<a name="line256"></a><div class="linenumber">256</div><div style="width:0em;display:inline-block"></div>pub.events.defaultListeners&nbsp;=&nbsp;{
<a name="line257"></a><div class="linenumber">257</div><div style="width:2em;display:inline-block"></div>"authenticate":&nbsp;eventListener.onAuthenticate,
<a name="line258"></a><div class="linenumber">258</div><div style="width:2em;display:inline-block"></div>"authenticated":&nbsp;eventListener.onAuthenticated,
<a name="line259"></a><div class="linenumber">259</div><div style="width:2em;display:inline-block"></div>"connection":&nbsp;eventListener.onConnection,
<a name="line260"></a><div class="linenumber">260</div><div style="width:2em;display:inline-block"></div>"disconnect":&nbsp;eventListener.onDisconnect,
<a name="line261"></a><div class="linenumber">261</div><div style="width:2em;display:inline-block"></div>"getIceConfig":&nbsp;eventListener.onGetIceConfig,
<a name="line262"></a><div class="linenumber">262</div><div style="width:2em;display:inline-block"></div>"roomCreate":&nbsp;eventListener.onRoomCreate,
<a name="line263"></a><div class="linenumber">263</div><div style="width:2em;display:inline-block"></div>"roomJoin":&nbsp;eventListener.onRoomJoin,
<a name="line264"></a><div class="linenumber">264</div><div style="width:2em;display:inline-block"></div>"roomLeave":&nbsp;eventListener.onRoomLeave,
<a name="line265"></a><div class="linenumber">265</div><div style="width:2em;display:inline-block"></div>"log":&nbsp;eventListener.onLog,
<a name="line266"></a><div class="linenumber">266</div><div style="width:2em;display:inline-block"></div>"shutdown":&nbsp;eventListener.onShutdown,
<a name="line267"></a><div class="linenumber">267</div><div style="width:2em;display:inline-block"></div>"startup":&nbsp;eventListener.onStartup,
<a name="line268"></a><div class="linenumber">268</div><div style="width:2em;display:inline-block"></div>"easyrtcAuth":&nbsp;eventListener.onEasyrtcAuth,
<a name="line269"></a><div class="linenumber">269</div><div style="width:2em;display:inline-block"></div>"easyrtcCmd":&nbsp;eventListener.onEasyrtcCmd,
<a name="line270"></a><div class="linenumber">270</div><div style="width:2em;display:inline-block"></div>"easyrtcMsg":&nbsp;eventListener.onEasyrtcMsg,
<a name="line271"></a><div class="linenumber">271</div><div style="width:2em;display:inline-block"></div>"emitEasyrtcCmd":&nbsp;eventListener.onEmitEasyrtcCmd,
<a name="line272"></a><div class="linenumber">272</div><div style="width:2em;display:inline-block"></div>"emitEasyrtcMsg":&nbsp;eventListener.onEmitEasyrtcMsg,
<a name="line273"></a><div class="linenumber">273</div><div style="width:2em;display:inline-block"></div>"emitError":&nbsp;eventListener.onEmitError,
<a name="line274"></a><div class="linenumber">274</div><div style="width:2em;display:inline-block"></div>"emitReturnAck":&nbsp;eventListener.onEmitReturnAck,
<a name="line275"></a><div class="linenumber">275</div><div style="width:2em;display:inline-block"></div>"emitReturnError":&nbsp;eventListener.onEmitReturnError,
<a name="line276"></a><div class="linenumber">276</div><div style="width:2em;display:inline-block"></div>"emitReturnToken":&nbsp;eventListener.onEmitReturnToken,
<a name="line277"></a><div class="linenumber">277</div><div style="width:2em;display:inline-block"></div>"msgTypeGetIceConfig":&nbsp;eventListener.onMsgTypeGetIceConfig,
<a name="line278"></a><div class="linenumber">278</div><div style="width:2em;display:inline-block"></div>"msgTypeGetRoomList":&nbsp;eventListener.onMsgTypeGetRoomList,
<a name="line279"></a><div class="linenumber">279</div><div style="width:2em;display:inline-block"></div>"msgTypeRoomJoin":&nbsp;eventListener.onMsgTypeRoomJoin,
<a name="line280"></a><div class="linenumber">280</div><div style="width:2em;display:inline-block"></div>"msgTypeRoomLeave":&nbsp;eventListener.onMsgTypeRoomLeave,
<a name="line281"></a><div class="linenumber">281</div><div style="width:2em;display:inline-block"></div>"msgTypeSetPresence":&nbsp;eventListener.onMsgTypeSetPresence,
<a name="line282"></a><div class="linenumber">282</div><div style="width:2em;display:inline-block"></div>"msgTypeSetRoomApiField":&nbsp;eventListener.onMsgTypeSetRoomApiField
<a name="line283"></a><div class="linenumber">283</div><div style="width:0em;display:inline-block"></div>};
<a name="line284"></a><div class="linenumber">284</div><div style="width:0em;display:inline-block"></div>
<a name="line285"></a><div class="linenumber">285</div><div style="width:0em;display:inline-block"></div>
<a name="line286"></a><div class="linenumber">286</div><div style="width:0em;display:inline-block"></div>/**
<a name="line287"></a><div class="linenumber">287</div><div style="width:0em;display:inline-block"></div>*&nbsp;Sets&nbsp;listener&nbsp;for&nbsp;a&nbsp;given&nbsp;EasyRTC&nbsp;event.&nbsp;Only&nbsp;one&nbsp;listener&nbsp;is&nbsp;allowed&nbsp;per&nbsp;event.&nbsp;Any&nbsp;other&nbsp;listeners&nbsp;for&nbsp;an&nbsp;event&nbsp;are&nbsp;removed&nbsp;before&nbsp;adding&nbsp;the&nbsp;new&nbsp;one.&nbsp;See&nbsp;the&nbsp;events&nbsp;documentation&nbsp;for&nbsp;expected&nbsp;listener&nbsp;parameters.
<a name="line288"></a><div class="linenumber">288</div><div style="width:0em;display:inline-block"></div>*
<a name="line289"></a><div class="linenumber">289</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;eventName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Listener&nbsp;name.
<a name="line290"></a><div class="linenumber">290</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function}&nbsp;listener&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Function&nbsp;to&nbsp;be&nbsp;called&nbsp;when&nbsp;listener&nbsp;is&nbsp;fired
<a name="line291"></a><div class="linenumber">291</div><div style="width:0em;display:inline-block"></div>*/
<a name="line292"></a><div class="linenumber">292</div><div style="width:0em;display:inline-block"></div>pub.events.on&nbsp;=&nbsp;function(eventName,&nbsp;listener)&nbsp;{
<a name="line293"></a><div class="linenumber">293</div><div style="width:2em;display:inline-block"></div>if&nbsp;(eventName&nbsp;&amp;&amp;&nbsp;_.isFunction(listener))&nbsp;{
<a name="line294"></a><div class="linenumber">294</div><div style="width:4em;display:inline-block"></div>pub.events._eventListener.removeAllListeners(eventName);
<a name="line295"></a><div class="linenumber">295</div><div style="width:4em;display:inline-block"></div>pub.events._eventListener.on(eventName,&nbsp;listener);
<a name="line296"></a><div class="linenumber">296</div><div style="width:2em;display:inline-block"></div>}
<a name="line297"></a><div class="linenumber">297</div><div style="width:2em;display:inline-block"></div>else&nbsp;{
<a name="line298"></a><div class="linenumber">298</div><div style="width:4em;display:inline-block"></div>pub.util.logError("Unable&nbsp;to&nbsp;add&nbsp;listener&nbsp;to&nbsp;event&nbsp;'"&nbsp;+&nbsp;eventName&nbsp;+&nbsp;"'");
<a name="line299"></a><div class="linenumber">299</div><div style="width:2em;display:inline-block"></div>}
<a name="line300"></a><div class="linenumber">300</div><div style="width:0em;display:inline-block"></div>};
<a name="line301"></a><div class="linenumber">301</div><div style="width:0em;display:inline-block"></div>
<a name="line302"></a><div class="linenumber">302</div><div style="width:0em;display:inline-block"></div>
<a name="line303"></a><div class="linenumber">303</div><div style="width:0em;display:inline-block"></div>/**
<a name="line304"></a><div class="linenumber">304</div><div style="width:0em;display:inline-block"></div>*&nbsp;Removes&nbsp;all&nbsp;listeners&nbsp;for&nbsp;an&nbsp;event.&nbsp;If&nbsp;there&nbsp;is&nbsp;a&nbsp;default&nbsp;EasyRTC&nbsp;listener,&nbsp;it&nbsp;will&nbsp;be&nbsp;added.&nbsp;If&nbsp;eventName&nbsp;is&nbsp;`null`,&nbsp;all&nbsp;events&nbsp;will&nbsp;be&nbsp;removed&nbsp;than&nbsp;the&nbsp;defaults&nbsp;will&nbsp;be&nbsp;restored.
<a name="line305"></a><div class="linenumber">305</div><div style="width:0em;display:inline-block"></div>*
<a name="line306"></a><div class="linenumber">306</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?string}&nbsp;eventName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Listener&nbsp;name.&nbsp;If&nbsp;`null`,&nbsp;then&nbsp;all&nbsp;events&nbsp;will&nbsp;be&nbsp;removed.
<a name="line307"></a><div class="linenumber">307</div><div style="width:0em;display:inline-block"></div>*/
<a name="line308"></a><div class="linenumber">308</div><div style="width:0em;display:inline-block"></div>pub.events.removeAllListeners&nbsp;=&nbsp;function(eventName)&nbsp;{
<a name="line309"></a><div class="linenumber">309</div><div style="width:2em;display:inline-block"></div>if&nbsp;(eventName)&nbsp;{
<a name="line310"></a><div class="linenumber">310</div><div style="width:4em;display:inline-block"></div>pub.events.setDefaultListener(eventName);
<a name="line311"></a><div class="linenumber">311</div><div style="width:2em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line312"></a><div class="linenumber">312</div><div style="width:4em;display:inline-block"></div>pub.events.setDefaultListeners();
<a name="line313"></a><div class="linenumber">313</div><div style="width:2em;display:inline-block"></div>}
<a name="line314"></a><div class="linenumber">314</div><div style="width:0em;display:inline-block"></div>};
<a name="line315"></a><div class="linenumber">315</div><div style="width:0em;display:inline-block"></div>
<a name="line316"></a><div class="linenumber">316</div><div style="width:0em;display:inline-block"></div>
<a name="line317"></a><div class="linenumber">317</div><div style="width:0em;display:inline-block"></div>/**
<a name="line318"></a><div class="linenumber">318</div><div style="width:0em;display:inline-block"></div>*&nbsp;General&nbsp;utility&nbsp;functions&nbsp;are&nbsp;grouped&nbsp;in&nbsp;this&nbsp;util&nbsp;object.&nbsp;&nbsp;For&nbsp;convenience,&nbsp;this&nbsp;class&nbsp;has&nbsp;also&nbsp;been&nbsp;attached&nbsp;to&nbsp;the&nbsp;application,&nbsp;connection,&nbsp;session,&nbsp;and&nbsp;room&nbsp;classes.
<a name="line319"></a><div class="linenumber">319</div><div style="width:0em;display:inline-block"></div>*&nbsp;@class
<a name="line320"></a><div class="linenumber">320</div><div style="width:0em;display:inline-block"></div>*/
<a name="line321"></a><div class="linenumber">321</div><div style="width:0em;display:inline-block"></div>pub.util&nbsp;=&nbsp;{};
<a name="line322"></a><div class="linenumber">322</div><div style="width:0em;display:inline-block"></div>
<a name="line323"></a><div class="linenumber">323</div><div style="width:0em;display:inline-block"></div>
<a name="line324"></a><div class="linenumber">324</div><div style="width:0em;display:inline-block"></div>/**
<a name="line325"></a><div class="linenumber">325</div><div style="width:0em;display:inline-block"></div>*&nbsp;Performs&nbsp;a&nbsp;deep&nbsp;copy&nbsp;of&nbsp;an&nbsp;object,&nbsp;returning&nbsp;the&nbsp;duplicate.
<a name="line326"></a><div class="linenumber">326</div><div style="width:0em;display:inline-block"></div>*&nbsp;Do&nbsp;not&nbsp;use&nbsp;on&nbsp;objects&nbsp;with&nbsp;circular&nbsp;references.
<a name="line327"></a><div class="linenumber">327</div><div style="width:0em;display:inline-block"></div>*
<a name="line328"></a><div class="linenumber">328</div><div style="width:0em;display:inline-block"></div>*&nbsp;@function
<a name="line329"></a><div class="linenumber">329</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;input&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Input&nbsp;variable&nbsp;(or&nbsp;object)&nbsp;to&nbsp;be&nbsp;copied.
<a name="line330"></a><div class="linenumber">330</div><div style="width:0em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;New&nbsp;copy&nbsp;of&nbsp;variable.
<a name="line331"></a><div class="linenumber">331</div><div style="width:0em;display:inline-block"></div>*/
<a name="line332"></a><div class="linenumber">332</div><div style="width:0em;display:inline-block"></div>pub.util.deepCopy&nbsp;=&nbsp;g.deepCopy;
<a name="line333"></a><div class="linenumber">333</div><div style="width:0em;display:inline-block"></div>
<a name="line334"></a><div class="linenumber">334</div><div style="width:0em;display:inline-block"></div>
<a name="line335"></a><div class="linenumber">335</div><div style="width:0em;display:inline-block"></div>/**
<a name="line336"></a><div class="linenumber">336</div><div style="width:0em;display:inline-block"></div>*&nbsp;An&nbsp;empty&nbsp;dummy&nbsp;function,&nbsp;which&nbsp;is&nbsp;designed&nbsp;to&nbsp;be&nbsp;used&nbsp;as&nbsp;a&nbsp;default&nbsp;callback&nbsp;in&nbsp;functions&nbsp;when&nbsp;none&nbsp;has&nbsp;been&nbsp;provided.
<a name="line337"></a><div class="linenumber">337</div><div style="width:0em;display:inline-block"></div>*
<a name="line338"></a><div class="linenumber">338</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Error}&nbsp;err&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;object
<a name="line339"></a><div class="linenumber">339</div><div style="width:0em;display:inline-block"></div>*/
<a name="line340"></a><div class="linenumber">340</div><div style="width:0em;display:inline-block"></div>pub.util.nextToNowhere&nbsp;=&nbsp;function(err)&nbsp;{
<a name="line341"></a><div class="linenumber">341</div><div style="width:0em;display:inline-block"></div>};
<a name="line342"></a><div class="linenumber">342</div><div style="width:0em;display:inline-block"></div>
<a name="line343"></a><div class="linenumber">343</div><div style="width:0em;display:inline-block"></div>/**
<a name="line344"></a><div class="linenumber">344</div><div style="width:0em;display:inline-block"></div>*&nbsp;Determines&nbsp;if&nbsp;an&nbsp;Error&nbsp;object&nbsp;is&nbsp;an&nbsp;instance&nbsp;of&nbsp;ApplicationError,&nbsp;ConnectionError,&nbsp;or&nbsp;ServerError.&nbsp;If&nbsp;it&nbsp;is,&nbsp;it&nbsp;will&nbsp;return&nbsp;true.
<a name="line345"></a><div class="linenumber">345</div><div style="width:0em;display:inline-block"></div>*
<a name="line346"></a><div class="linenumber">346</div><div style="width:0em;display:inline-block"></div>*&nbsp;@function
<a name="line347"></a><div class="linenumber">347</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{*|Error}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Will&nbsp;accept&nbsp;any&nbsp;value,&nbsp;but&nbsp;will&nbsp;only&nbsp;return&nbsp;true&nbsp;for&nbsp;appropriate&nbsp;error&nbsp;objects.
<a name="line348"></a><div class="linenumber">348</div><div style="width:0em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Boolean}
<a name="line349"></a><div class="linenumber">349</div><div style="width:0em;display:inline-block"></div>*/
<a name="line350"></a><div class="linenumber">350</div><div style="width:0em;display:inline-block"></div>pub.util.isError&nbsp;=&nbsp;eu.isError;
<a name="line351"></a><div class="linenumber">351</div><div style="width:0em;display:inline-block"></div>
<a name="line352"></a><div class="linenumber">352</div><div style="width:0em;display:inline-block"></div>
<a name="line353"></a><div class="linenumber">353</div><div style="width:0em;display:inline-block"></div>/**
<a name="line354"></a><div class="linenumber">354</div><div style="width:0em;display:inline-block"></div>*&nbsp;Determines&nbsp;if&nbsp;an&nbsp;Error&nbsp;object&nbsp;is&nbsp;an&nbsp;instance&nbsp;of&nbsp;ApplicationWarning,&nbsp;ConnectionWarning,&nbsp;or&nbsp;ServerWarning.&nbsp;If&nbsp;it&nbsp;is,&nbsp;it&nbsp;will&nbsp;return&nbsp;true.
<a name="line355"></a><div class="linenumber">355</div><div style="width:0em;display:inline-block"></div>*
<a name="line356"></a><div class="linenumber">356</div><div style="width:0em;display:inline-block"></div>*&nbsp;@function
<a name="line357"></a><div class="linenumber">357</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{*|Error}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Will&nbsp;accept&nbsp;any&nbsp;value,&nbsp;but&nbsp;will&nbsp;only&nbsp;return&nbsp;true&nbsp;for&nbsp;appropriate&nbsp;error&nbsp;objects.
<a name="line358"></a><div class="linenumber">358</div><div style="width:0em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Boolean}
<a name="line359"></a><div class="linenumber">359</div><div style="width:0em;display:inline-block"></div>*/
<a name="line360"></a><div class="linenumber">360</div><div style="width:0em;display:inline-block"></div>pub.util.isWarning&nbsp;=&nbsp;eu.isWarning;
<a name="line361"></a><div class="linenumber">361</div><div style="width:0em;display:inline-block"></div>
<a name="line362"></a><div class="linenumber">362</div><div style="width:0em;display:inline-block"></div>
<a name="line363"></a><div class="linenumber">363</div><div style="width:0em;display:inline-block"></div>/**
<a name="line364"></a><div class="linenumber">364</div><div style="width:0em;display:inline-block"></div>*&nbsp;Custom&nbsp;Error&nbsp;Object&nbsp;for&nbsp;EasyRTC&nbsp;Application&nbsp;Errors.
<a name="line365"></a><div class="linenumber">365</div><div style="width:0em;display:inline-block"></div>*
<a name="line366"></a><div class="linenumber">366</div><div style="width:0em;display:inline-block"></div>*&nbsp;@extends&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error
<a name="line367"></a><div class="linenumber">367</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;message&nbsp;describing&nbsp;the&nbsp;error.
<a name="line368"></a><div class="linenumber">368</div><div style="width:0em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Error}
<a name="line369"></a><div class="linenumber">369</div><div style="width:0em;display:inline-block"></div>*/
<a name="line370"></a><div class="linenumber">370</div><div style="width:0em;display:inline-block"></div>pub.util.ApplicationError&nbsp;=&nbsp;eu.ApplicationError;
<a name="line371"></a><div class="linenumber">371</div><div style="width:0em;display:inline-block"></div>
<a name="line372"></a><div class="linenumber">372</div><div style="width:0em;display:inline-block"></div>
<a name="line373"></a><div class="linenumber">373</div><div style="width:0em;display:inline-block"></div>/**
<a name="line374"></a><div class="linenumber">374</div><div style="width:0em;display:inline-block"></div>*&nbsp;Custom&nbsp;Error&nbsp;Object&nbsp;for&nbsp;EasyRTC&nbsp;Application&nbsp;Warnings.
<a name="line375"></a><div class="linenumber">375</div><div style="width:0em;display:inline-block"></div>*
<a name="line376"></a><div class="linenumber">376</div><div style="width:0em;display:inline-block"></div>*&nbsp;@extends&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error
<a name="line377"></a><div class="linenumber">377</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;message&nbsp;describing&nbsp;the&nbsp;error.
<a name="line378"></a><div class="linenumber">378</div><div style="width:0em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Error}
<a name="line379"></a><div class="linenumber">379</div><div style="width:0em;display:inline-block"></div>*/
<a name="line380"></a><div class="linenumber">380</div><div style="width:0em;display:inline-block"></div>pub.util.ApplicationWarning&nbsp;=&nbsp;eu.ApplicationWarning;
<a name="line381"></a><div class="linenumber">381</div><div style="width:0em;display:inline-block"></div>
<a name="line382"></a><div class="linenumber">382</div><div style="width:0em;display:inline-block"></div>
<a name="line383"></a><div class="linenumber">383</div><div style="width:0em;display:inline-block"></div>/**
<a name="line384"></a><div class="linenumber">384</div><div style="width:0em;display:inline-block"></div>*&nbsp;Custom&nbsp;Error&nbsp;Object&nbsp;for&nbsp;EasyRTC&nbsp;C&nbsp;Errors.
<a name="line385"></a><div class="linenumber">385</div><div style="width:0em;display:inline-block"></div>*
<a name="line386"></a><div class="linenumber">386</div><div style="width:0em;display:inline-block"></div>*&nbsp;@function
<a name="line387"></a><div class="linenumber">387</div><div style="width:0em;display:inline-block"></div>*&nbsp;@extends&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error
<a name="line388"></a><div class="linenumber">388</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;message&nbsp;describing&nbsp;the&nbsp;error.
<a name="line389"></a><div class="linenumber">389</div><div style="width:0em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Error}
<a name="line390"></a><div class="linenumber">390</div><div style="width:0em;display:inline-block"></div>*/
<a name="line391"></a><div class="linenumber">391</div><div style="width:0em;display:inline-block"></div>pub.util.ConnectionError&nbsp;=&nbsp;eu.ConnectionError;
<a name="line392"></a><div class="linenumber">392</div><div style="width:0em;display:inline-block"></div>
<a name="line393"></a><div class="linenumber">393</div><div style="width:0em;display:inline-block"></div>/**
<a name="line394"></a><div class="linenumber">394</div><div style="width:0em;display:inline-block"></div>*&nbsp;Custom&nbsp;Error&nbsp;Object&nbsp;for&nbsp;EasyRTC&nbsp;Connection&nbsp;Warnings.
<a name="line395"></a><div class="linenumber">395</div><div style="width:0em;display:inline-block"></div>*
<a name="line396"></a><div class="linenumber">396</div><div style="width:0em;display:inline-block"></div>*&nbsp;@function
<a name="line397"></a><div class="linenumber">397</div><div style="width:0em;display:inline-block"></div>*&nbsp;@extends&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error
<a name="line398"></a><div class="linenumber">398</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;message&nbsp;describing&nbsp;the&nbsp;error.
<a name="line399"></a><div class="linenumber">399</div><div style="width:0em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Error}
<a name="line400"></a><div class="linenumber">400</div><div style="width:0em;display:inline-block"></div>*/
<a name="line401"></a><div class="linenumber">401</div><div style="width:0em;display:inline-block"></div>pub.util.ConnectionWarning&nbsp;=&nbsp;eu.ConnectionWarning;
<a name="line402"></a><div class="linenumber">402</div><div style="width:0em;display:inline-block"></div>
<a name="line403"></a><div class="linenumber">403</div><div style="width:0em;display:inline-block"></div>
<a name="line404"></a><div class="linenumber">404</div><div style="width:0em;display:inline-block"></div>/**
<a name="line405"></a><div class="linenumber">405</div><div style="width:0em;display:inline-block"></div>*&nbsp;Custom&nbsp;Error&nbsp;Object&nbsp;for&nbsp;EasyRTC&nbsp;Server&nbsp;Errors.
<a name="line406"></a><div class="linenumber">406</div><div style="width:0em;display:inline-block"></div>*
<a name="line407"></a><div class="linenumber">407</div><div style="width:0em;display:inline-block"></div>*&nbsp;@function
<a name="line408"></a><div class="linenumber">408</div><div style="width:0em;display:inline-block"></div>*&nbsp;@extends&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error
<a name="line409"></a><div class="linenumber">409</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;message&nbsp;describing&nbsp;the&nbsp;error.
<a name="line410"></a><div class="linenumber">410</div><div style="width:0em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Error}
<a name="line411"></a><div class="linenumber">411</div><div style="width:0em;display:inline-block"></div>*/
<a name="line412"></a><div class="linenumber">412</div><div style="width:0em;display:inline-block"></div>pub.util.ServerError&nbsp;=&nbsp;eu.ServerError;
<a name="line413"></a><div class="linenumber">413</div><div style="width:0em;display:inline-block"></div>
<a name="line414"></a><div class="linenumber">414</div><div style="width:0em;display:inline-block"></div>
<a name="line415"></a><div class="linenumber">415</div><div style="width:0em;display:inline-block"></div>/**
<a name="line416"></a><div class="linenumber">416</div><div style="width:0em;display:inline-block"></div>*&nbsp;Custom&nbsp;Error&nbsp;Object&nbsp;for&nbsp;EasyRTC&nbsp;Server&nbsp;Warnings.
<a name="line417"></a><div class="linenumber">417</div><div style="width:0em;display:inline-block"></div>*
<a name="line418"></a><div class="linenumber">418</div><div style="width:0em;display:inline-block"></div>*&nbsp;@function
<a name="line419"></a><div class="linenumber">419</div><div style="width:0em;display:inline-block"></div>*&nbsp;@extends&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error
<a name="line420"></a><div class="linenumber">420</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;message&nbsp;describing&nbsp;the&nbsp;error.
<a name="line421"></a><div class="linenumber">421</div><div style="width:0em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Error}
<a name="line422"></a><div class="linenumber">422</div><div style="width:0em;display:inline-block"></div>*/
<a name="line423"></a><div class="linenumber">423</div><div style="width:0em;display:inline-block"></div>pub.util.ServerWarning&nbsp;=&nbsp;eu.ServerWarning;
<a name="line424"></a><div class="linenumber">424</div><div style="width:0em;display:inline-block"></div>
<a name="line425"></a><div class="linenumber">425</div><div style="width:0em;display:inline-block"></div>
<a name="line426"></a><div class="linenumber">426</div><div style="width:0em;display:inline-block"></div>/**
<a name="line427"></a><div class="linenumber">427</div><div style="width:0em;display:inline-block"></div>*&nbsp;Returns&nbsp;a&nbsp;random&nbsp;available&nbsp;easyrtcid.
<a name="line428"></a><div class="linenumber">428</div><div style="width:0em;display:inline-block"></div>*
<a name="line429"></a><div class="linenumber">429</div><div style="width:0em;display:inline-block"></div>*&nbsp;@function
<a name="line430"></a><div class="linenumber">430</div><div style="width:0em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;{String}&nbsp;Available&nbsp;easyrtcid.&nbsp;A&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;an&nbsp;EasyRTC&nbsp;connection.
<a name="line431"></a><div class="linenumber">431</div><div style="width:0em;display:inline-block"></div>*/
<a name="line432"></a><div class="linenumber">432</div><div style="width:0em;display:inline-block"></div>pub.util.getAvailableEasyrtcid&nbsp;=&nbsp;eu.getAvailableEasyrtcid;
<a name="line433"></a><div class="linenumber">433</div><div style="width:0em;display:inline-block"></div>
<a name="line434"></a><div class="linenumber">434</div><div style="width:0em;display:inline-block"></div>
<a name="line435"></a><div class="linenumber">435</div><div style="width:0em;display:inline-block"></div>/**
<a name="line436"></a><div class="linenumber">436</div><div style="width:0em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;EasyRTC&nbsp;message&nbsp;error&nbsp;object&nbsp;for&nbsp;a&nbsp;specific&nbsp;error&nbsp;code.&nbsp;This&nbsp;is&nbsp;meant&nbsp;to&nbsp;be&nbsp;emitted&nbsp;or&nbsp;returned&nbsp;to&nbsp;a&nbsp;websocket&nbsp;client.
<a name="line437"></a><div class="linenumber">437</div><div style="width:0em;display:inline-block"></div>*
<a name="line438"></a><div class="linenumber">438</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;errorCode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;error&nbsp;code&nbsp;associated&nbsp;with&nbsp;an&nbsp;error.
<a name="line439"></a><div class="linenumber">439</div><div style="width:0em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;message&nbsp;error&nbsp;object&nbsp;for&nbsp;the&nbsp;specific&nbsp;error&nbsp;code.
<a name="line440"></a><div class="linenumber">440</div><div style="width:0em;display:inline-block"></div>*/
<a name="line441"></a><div class="linenumber">441</div><div style="width:0em;display:inline-block"></div>pub.util.getErrorMsg&nbsp;=&nbsp;function(errorCode)&nbsp;{
<a name="line442"></a><div class="linenumber">442</div><div style="width:2em;display:inline-block"></div>var&nbsp;msg&nbsp;=&nbsp;{
<a name="line443"></a><div class="linenumber">443</div><div style="width:4em;display:inline-block"></div>msgType:&nbsp;"error",
<a name="line444"></a><div class="linenumber">444</div><div style="width:4em;display:inline-block"></div>serverTime:&nbsp;Date.now(),
<a name="line445"></a><div class="linenumber">445</div><div style="width:4em;display:inline-block"></div>msgData:&nbsp;{
<a name="line446"></a><div class="linenumber">446</div><div style="width:6em;display:inline-block"></div>errorCode:&nbsp;errorCode,
<a name="line447"></a><div class="linenumber">447</div><div style="width:6em;display:inline-block"></div>errorText:&nbsp;pub.util.getErrorText(errorCode)
<a name="line448"></a><div class="linenumber">448</div><div style="width:4em;display:inline-block"></div>}
<a name="line449"></a><div class="linenumber">449</div><div style="width:2em;display:inline-block"></div>};
<a name="line450"></a><div class="linenumber">450</div><div style="width:0em;display:inline-block"></div>
<a name="line451"></a><div class="linenumber">451</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!msg.msgData.errorText)&nbsp;{
<a name="line452"></a><div class="linenumber">452</div><div style="width:4em;display:inline-block"></div>msg.msgData.errorText&nbsp;=&nbsp;"Error&nbsp;occurred&nbsp;with&nbsp;error&nbsp;code:&nbsp;"&nbsp;+&nbsp;errorCode;
<a name="line453"></a><div class="linenumber">453</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("Emitted&nbsp;unknown&nbsp;error&nbsp;with&nbsp;error&nbsp;code&nbsp;["&nbsp;+&nbsp;errorCode&nbsp;+&nbsp;"]");
<a name="line454"></a><div class="linenumber">454</div><div style="width:2em;display:inline-block"></div>}
<a name="line455"></a><div class="linenumber">455</div><div style="width:0em;display:inline-block"></div>
<a name="line456"></a><div class="linenumber">456</div><div style="width:2em;display:inline-block"></div>return&nbsp;msg;
<a name="line457"></a><div class="linenumber">457</div><div style="width:0em;display:inline-block"></div>};
<a name="line458"></a><div class="linenumber">458</div><div style="width:0em;display:inline-block"></div>
<a name="line459"></a><div class="linenumber">459</div><div style="width:0em;display:inline-block"></div>
<a name="line460"></a><div class="linenumber">460</div><div style="width:0em;display:inline-block"></div>/**
<a name="line461"></a><div class="linenumber">461</div><div style="width:0em;display:inline-block"></div>*&nbsp;Returns&nbsp;human&nbsp;readable&nbsp;text&nbsp;for&nbsp;a&nbsp;given&nbsp;error&nbsp;code.&nbsp;If&nbsp;an&nbsp;unknown&nbsp;error&nbsp;code&nbsp;is&nbsp;provided,&nbsp;a&nbsp;null&nbsp;value&nbsp;will&nbsp;be&nbsp;returned.
<a name="line462"></a><div class="linenumber">462</div><div style="width:0em;display:inline-block"></div>*
<a name="line463"></a><div class="linenumber">463</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;errorCode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;error&nbsp;code&nbsp;associated&nbsp;with&nbsp;an&nbsp;error.
<a name="line464"></a><div class="linenumber">464</div><div style="width:0em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Human&nbsp;readable&nbsp;error&nbsp;string
<a name="line465"></a><div class="linenumber">465</div><div style="width:0em;display:inline-block"></div>*/
<a name="line466"></a><div class="linenumber">466</div><div style="width:0em;display:inline-block"></div>pub.util.getErrorText&nbsp;=&nbsp;function(errorCode)&nbsp;{
<a name="line467"></a><div class="linenumber">467</div><div style="width:2em;display:inline-block"></div>switch&nbsp;(errorCode)&nbsp;{
<a name="line468"></a><div class="linenumber">468</div><div style="width:4em;display:inline-block"></div>case&nbsp;"BANNED_IP_ADDR":
<a name="line469"></a><div class="linenumber">469</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Client&nbsp;IP&nbsp;address&nbsp;is&nbsp;banned.&nbsp;Socket&nbsp;will&nbsp;be&nbsp;disconnected.";
<a name="line470"></a><div class="linenumber">470</div><div style="width:6em;display:inline-block"></div>break;
<a name="line471"></a><div class="linenumber">471</div><div style="width:4em;display:inline-block"></div>case&nbsp;"LOGIN_APP_AUTH_FAIL":
<a name="line472"></a><div class="linenumber">472</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Authentication&nbsp;for&nbsp;application&nbsp;failed.&nbsp;Socket&nbsp;will&nbsp;be&nbsp;disconnected.";
<a name="line473"></a><div class="linenumber">473</div><div style="width:6em;display:inline-block"></div>break;
<a name="line474"></a><div class="linenumber">474</div><div style="width:4em;display:inline-block"></div>case&nbsp;"LOGIN_BAD_APP_NAME":
<a name="line475"></a><div class="linenumber">475</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Provided&nbsp;application&nbsp;name&nbsp;is&nbsp;improper.&nbsp;Socket&nbsp;will&nbsp;be&nbsp;disconnected.";
<a name="line476"></a><div class="linenumber">476</div><div style="width:6em;display:inline-block"></div>break;
<a name="line477"></a><div class="linenumber">477</div><div style="width:4em;display:inline-block"></div>case&nbsp;"LOGIN_BAD_AUTH":
<a name="line478"></a><div class="linenumber">478</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Authentication&nbsp;for&nbsp;application&nbsp;failed.&nbsp;Socket&nbsp;will&nbsp;be&nbsp;disconnected.";
<a name="line479"></a><div class="linenumber">479</div><div style="width:6em;display:inline-block"></div>break;
<a name="line480"></a><div class="linenumber">480</div><div style="width:4em;display:inline-block"></div>case&nbsp;"LOGIN_BAD_ROOM":
<a name="line481"></a><div class="linenumber">481</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Requested&nbsp;room&nbsp;is&nbsp;invalid&nbsp;or&nbsp;does&nbsp;not&nbsp;exist.&nbsp;Socket&nbsp;will&nbsp;be&nbsp;disconnected.";
<a name="line482"></a><div class="linenumber">482</div><div style="width:6em;display:inline-block"></div>break;
<a name="line483"></a><div class="linenumber">483</div><div style="width:4em;display:inline-block"></div>case&nbsp;"LOGIN_BAD_STRUCTURE":
<a name="line484"></a><div class="linenumber">484</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Authentication&nbsp;for&nbsp;application&nbsp;failed.&nbsp;The&nbsp;provided&nbsp;structure&nbsp;is&nbsp;improper.&nbsp;Socket&nbsp;will&nbsp;be&nbsp;disconnected.";
<a name="line485"></a><div class="linenumber">485</div><div style="width:6em;display:inline-block"></div>break;
<a name="line486"></a><div class="linenumber">486</div><div style="width:4em;display:inline-block"></div>case&nbsp;"LOGIN_BAD_USER_CFG":
<a name="line487"></a><div class="linenumber">487</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Provided&nbsp;configuration&nbsp;options&nbsp;improper&nbsp;or&nbsp;invalid.&nbsp;Socket&nbsp;will&nbsp;be&nbsp;disconnected.";
<a name="line488"></a><div class="linenumber">488</div><div style="width:6em;display:inline-block"></div>break;
<a name="line489"></a><div class="linenumber">489</div><div style="width:4em;display:inline-block"></div>case&nbsp;"LOGIN_GEN_FAIL":
<a name="line490"></a><div class="linenumber">490</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Authentication&nbsp;failed.&nbsp;Socket&nbsp;will&nbsp;be&nbsp;disconnected.";
<a name="line491"></a><div class="linenumber">491</div><div style="width:6em;display:inline-block"></div>break;
<a name="line492"></a><div class="linenumber">492</div><div style="width:4em;display:inline-block"></div>case&nbsp;"LOGIN_NO_SOCKETS":
<a name="line493"></a><div class="linenumber">493</div><div style="width:6em;display:inline-block"></div>return&nbsp;"No&nbsp;sockets&nbsp;available&nbsp;for&nbsp;account.&nbsp;Socket&nbsp;will&nbsp;be&nbsp;disconnected.";
<a name="line494"></a><div class="linenumber">494</div><div style="width:6em;display:inline-block"></div>break;
<a name="line495"></a><div class="linenumber">495</div><div style="width:4em;display:inline-block"></div>case&nbsp;"LOGIN_TIMEOUT":
<a name="line496"></a><div class="linenumber">496</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Login&nbsp;has&nbsp;timed&nbsp;out.&nbsp;Socket&nbsp;will&nbsp;be&nbsp;disconnected.";
<a name="line497"></a><div class="linenumber">497</div><div style="width:6em;display:inline-block"></div>break;
<a name="line498"></a><div class="linenumber">498</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_BAD_DATA":
<a name="line499"></a><div class="linenumber">499</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;The&nbsp;provided&nbsp;msgData&nbsp;is&nbsp;improper.";
<a name="line500"></a><div class="linenumber">500</div><div style="width:6em;display:inline-block"></div>break;
<a name="line501"></a><div class="linenumber">501</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_BAD_ROOM":
<a name="line502"></a><div class="linenumber">502</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;Requested&nbsp;room&nbsp;is&nbsp;invalid&nbsp;or&nbsp;does&nbsp;not&nbsp;exist.";
<a name="line503"></a><div class="linenumber">503</div><div style="width:6em;display:inline-block"></div>break;
<a name="line504"></a><div class="linenumber">504</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_BAD_FIELD":
<a name="line505"></a><div class="linenumber">505</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;Problem&nbsp;with&nbsp;field&nbsp;structure&nbsp;or&nbsp;name.";
<a name="line506"></a><div class="linenumber">506</div><div style="width:6em;display:inline-block"></div>break;
<a name="line507"></a><div class="linenumber">507</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_BAD_SIZE":
<a name="line508"></a><div class="linenumber">508</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;Packet&nbsp;size&nbsp;is&nbsp;too&nbsp;large.";
<a name="line509"></a><div class="linenumber">509</div><div style="width:6em;display:inline-block"></div>break;
<a name="line510"></a><div class="linenumber">510</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_BAD_STRUCTURE":
<a name="line511"></a><div class="linenumber">511</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;The&nbsp;provided&nbsp;structure&nbsp;is&nbsp;improper.";
<a name="line512"></a><div class="linenumber">512</div><div style="width:6em;display:inline-block"></div>break;
<a name="line513"></a><div class="linenumber">513</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_BAD_TYPE":
<a name="line514"></a><div class="linenumber">514</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;The&nbsp;provided&nbsp;msgType&nbsp;is&nbsp;unsupported.";
<a name="line515"></a><div class="linenumber">515</div><div style="width:6em;display:inline-block"></div>break;
<a name="line516"></a><div class="linenumber">516</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_GEN_FAIL":
<a name="line517"></a><div class="linenumber">517</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;General&nbsp;failure&nbsp;occurred.";
<a name="line518"></a><div class="linenumber">518</div><div style="width:6em;display:inline-block"></div>break;
<a name="line519"></a><div class="linenumber">519</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_NO_AUTH":
<a name="line520"></a><div class="linenumber">520</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;Not&nbsp;logged&nbsp;in&nbsp;or&nbsp;client&nbsp;not&nbsp;authorized.";
<a name="line521"></a><div class="linenumber">521</div><div style="width:6em;display:inline-block"></div>break;
<a name="line522"></a><div class="linenumber">522</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_NO_ROOM_LIST":
<a name="line523"></a><div class="linenumber">523</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;Room&nbsp;list&nbsp;unavailable.";
<a name="line524"></a><div class="linenumber">524</div><div style="width:6em;display:inline-block"></div>break;
<a name="line525"></a><div class="linenumber">525</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_PRESENCE":
<a name="line526"></a><div class="linenumber">526</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;Presence&nbsp;could&nbsp;could&nbsp;not&nbsp;be&nbsp;set.";
<a name="line527"></a><div class="linenumber">527</div><div style="width:6em;display:inline-block"></div>break;
<a name="line528"></a><div class="linenumber">528</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_TARGET_EASYRTCID":
<a name="line529"></a><div class="linenumber">529</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;Target&nbsp;easyrtcid&nbsp;is&nbsp;invalid,&nbsp;not&nbsp;using&nbsp;same&nbsp;application,&nbsp;or&nbsp;no&nbsp;longer&nbsp;online.";
<a name="line530"></a><div class="linenumber">530</div><div style="width:6em;display:inline-block"></div>break;
<a name="line531"></a><div class="linenumber">531</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_TARGET_GROUP":
<a name="line532"></a><div class="linenumber">532</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;Target&nbsp;group&nbsp;is&nbsp;invalid&nbsp;or&nbsp;not&nbsp;defined.";
<a name="line533"></a><div class="linenumber">533</div><div style="width:6em;display:inline-block"></div>break;
<a name="line534"></a><div class="linenumber">534</div><div style="width:4em;display:inline-block"></div>case&nbsp;"MSG_REJECT_TARGET_ROOM":
<a name="line535"></a><div class="linenumber">535</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Message&nbsp;rejected.&nbsp;Target&nbsp;room&nbsp;is&nbsp;invalid&nbsp;or&nbsp;not&nbsp;created.";
<a name="line536"></a><div class="linenumber">536</div><div style="width:6em;display:inline-block"></div>break;
<a name="line537"></a><div class="linenumber">537</div><div style="width:4em;display:inline-block"></div>case&nbsp;"SERVER_SHUTDOWN":
<a name="line538"></a><div class="linenumber">538</div><div style="width:6em;display:inline-block"></div>return&nbsp;"Server&nbsp;is&nbsp;being&nbsp;shutdown.&nbsp;Socket&nbsp;will&nbsp;be&nbsp;disconnected.";
<a name="line539"></a><div class="linenumber">539</div><div style="width:6em;display:inline-block"></div>break;
<a name="line540"></a><div class="linenumber">540</div><div style="width:4em;display:inline-block"></div>default:
<a name="line541"></a><div class="linenumber">541</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Unknown&nbsp;message&nbsp;errorCode&nbsp;requested&nbsp;["&nbsp;+&nbsp;errorCode&nbsp;+&nbsp;"]");
<a name="line542"></a><div class="linenumber">542</div><div style="width:6em;display:inline-block"></div>return&nbsp;null;
<a name="line543"></a><div class="linenumber">543</div><div style="width:2em;display:inline-block"></div>}
<a name="line544"></a><div class="linenumber">544</div><div style="width:0em;display:inline-block"></div>};
<a name="line545"></a><div class="linenumber">545</div><div style="width:0em;display:inline-block"></div>
<a name="line546"></a><div class="linenumber">546</div><div style="width:0em;display:inline-block"></div>
<a name="line547"></a><div class="linenumber">547</div><div style="width:0em;display:inline-block"></div>/**
<a name="line548"></a><div class="linenumber">548</div><div style="width:0em;display:inline-block"></div>*&nbsp;General&nbsp;logging&nbsp;function&nbsp;which&nbsp;emits&nbsp;a&nbsp;log&nbsp;event&nbsp;so&nbsp;long&nbsp;as&nbsp;the&nbsp;log&nbsp;level&nbsp;has&nbsp;a&nbsp;severity&nbsp;equal&nbsp;or&nbsp;greater&nbsp;than&nbsp;e.option.logLevel
<a name="line549"></a><div class="linenumber">549</div><div style="width:0em;display:inline-block"></div>*
<a name="line550"></a><div class="linenumber">550</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Log&nbsp;severity&nbsp;level.&nbsp;Can&nbsp;be&nbsp;("debug"|"info"|"warning"|"error")
<a name="line551"></a><div class="linenumber">551</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;logText&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;for&nbsp;log.
<a name="line552"></a><div class="linenumber">552</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;[logFields]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple&nbsp;JSON&nbsp;object&nbsp;which&nbsp;contains&nbsp;extra&nbsp;fields&nbsp;to&nbsp;be&nbsp;logged.
<a name="line553"></a><div class="linenumber">553</div><div style="width:0em;display:inline-block"></div>*/
<a name="line554"></a><div class="linenumber">554</div><div style="width:0em;display:inline-block"></div>pub.util.log&nbsp;=&nbsp;function(level,&nbsp;logText,&nbsp;logFields)&nbsp;{
<a name="line555"></a><div class="linenumber">555</div><div style="width:2em;display:inline-block"></div>switch&nbsp;(e.option.logLevel)&nbsp;{
<a name="line556"></a><div class="linenumber">556</div><div style="width:4em;display:inline-block"></div>case&nbsp;"error":
<a name="line557"></a><div class="linenumber">557</div><div style="width:6em;display:inline-block"></div>if&nbsp;(level&nbsp;!=&nbsp;"error")&nbsp;{
<a name="line558"></a><div class="linenumber">558</div><div style="width:8em;display:inline-block"></div>break;
<a name="line559"></a><div class="linenumber">559</div><div style="width:6em;display:inline-block"></div>}
<a name="line560"></a><div class="linenumber">560</div><div style="width:0em;display:inline-block"></div>
<a name="line561"></a><div class="linenumber">561</div><div style="width:4em;display:inline-block"></div>case&nbsp;"warning":
<a name="line562"></a><div class="linenumber">562</div><div style="width:6em;display:inline-block"></div>if&nbsp;(level&nbsp;==&nbsp;"info")&nbsp;{
<a name="line563"></a><div class="linenumber">563</div><div style="width:8em;display:inline-block"></div>break;
<a name="line564"></a><div class="linenumber">564</div><div style="width:6em;display:inline-block"></div>}
<a name="line565"></a><div class="linenumber">565</div><div style="width:0em;display:inline-block"></div>
<a name="line566"></a><div class="linenumber">566</div><div style="width:4em;display:inline-block"></div>case&nbsp;"info":
<a name="line567"></a><div class="linenumber">567</div><div style="width:6em;display:inline-block"></div>if&nbsp;(level&nbsp;==&nbsp;"debug")&nbsp;{
<a name="line568"></a><div class="linenumber">568</div><div style="width:8em;display:inline-block"></div>break;
<a name="line569"></a><div class="linenumber">569</div><div style="width:6em;display:inline-block"></div>}
<a name="line570"></a><div class="linenumber">570</div><div style="width:0em;display:inline-block"></div>
<a name="line571"></a><div class="linenumber">571</div><div style="width:4em;display:inline-block"></div>case&nbsp;"debug":
<a name="line572"></a><div class="linenumber">572</div><div style="width:6em;display:inline-block"></div>pub.events.emit("log",&nbsp;level,&nbsp;logText,&nbsp;logFields);
<a name="line573"></a><div class="linenumber">573</div><div style="width:2em;display:inline-block"></div>}
<a name="line574"></a><div class="linenumber">574</div><div style="width:0em;display:inline-block"></div>};
<a name="line575"></a><div class="linenumber">575</div><div style="width:0em;display:inline-block"></div>
<a name="line576"></a><div class="linenumber">576</div><div style="width:0em;display:inline-block"></div>
<a name="line577"></a><div class="linenumber">577</div><div style="width:0em;display:inline-block"></div>/**
<a name="line578"></a><div class="linenumber">578</div><div style="width:0em;display:inline-block"></div>*&nbsp;Convenience&nbsp;function&nbsp;for&nbsp;logging&nbsp;"debug"&nbsp;level&nbsp;items.
<a name="line579"></a><div class="linenumber">579</div><div style="width:0em;display:inline-block"></div>*
<a name="line580"></a><div class="linenumber">580</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;logText&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;for&nbsp;log.
<a name="line581"></a><div class="linenumber">581</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;[logFields]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple&nbsp;JSON&nbsp;object&nbsp;which&nbsp;contains&nbsp;extra&nbsp;fields&nbsp;to&nbsp;be&nbsp;logged.
<a name="line582"></a><div class="linenumber">582</div><div style="width:0em;display:inline-block"></div>*/
<a name="line583"></a><div class="linenumber">583</div><div style="width:0em;display:inline-block"></div>pub.util.logDebug&nbsp;=&nbsp;function(logText,&nbsp;logFields)&nbsp;{
<a name="line584"></a><div class="linenumber">584</div><div style="width:2em;display:inline-block"></div>pub.util.log("debug",&nbsp;logText,&nbsp;logFields);
<a name="line585"></a><div class="linenumber">585</div><div style="width:0em;display:inline-block"></div>};
<a name="line586"></a><div class="linenumber">586</div><div style="width:0em;display:inline-block"></div>
<a name="line587"></a><div class="linenumber">587</div><div style="width:0em;display:inline-block"></div>
<a name="line588"></a><div class="linenumber">588</div><div style="width:0em;display:inline-block"></div>/**
<a name="line589"></a><div class="linenumber">589</div><div style="width:0em;display:inline-block"></div>*&nbsp;Convenience&nbsp;function&nbsp;for&nbsp;logging&nbsp;"info"&nbsp;level&nbsp;items.
<a name="line590"></a><div class="linenumber">590</div><div style="width:0em;display:inline-block"></div>*
<a name="line591"></a><div class="linenumber">591</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;logText&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;for&nbsp;log.
<a name="line592"></a><div class="linenumber">592</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;[logFields]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple&nbsp;JSON&nbsp;object&nbsp;which&nbsp;contains&nbsp;extra&nbsp;fields&nbsp;to&nbsp;be&nbsp;logged.
<a name="line593"></a><div class="linenumber">593</div><div style="width:0em;display:inline-block"></div>*/
<a name="line594"></a><div class="linenumber">594</div><div style="width:0em;display:inline-block"></div>pub.util.logInfo&nbsp;=&nbsp;function(logText,&nbsp;logFields)&nbsp;{
<a name="line595"></a><div class="linenumber">595</div><div style="width:2em;display:inline-block"></div>pub.util.log("info",&nbsp;logText,&nbsp;logFields);
<a name="line596"></a><div class="linenumber">596</div><div style="width:0em;display:inline-block"></div>};
<a name="line597"></a><div class="linenumber">597</div><div style="width:0em;display:inline-block"></div>
<a name="line598"></a><div class="linenumber">598</div><div style="width:0em;display:inline-block"></div>
<a name="line599"></a><div class="linenumber">599</div><div style="width:0em;display:inline-block"></div>/**
<a name="line600"></a><div class="linenumber">600</div><div style="width:0em;display:inline-block"></div>*&nbsp;Convenience&nbsp;function&nbsp;for&nbsp;logging&nbsp;"warning"&nbsp;level&nbsp;items.
<a name="line601"></a><div class="linenumber">601</div><div style="width:0em;display:inline-block"></div>*
<a name="line602"></a><div class="linenumber">602</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;logText&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;for&nbsp;log.
<a name="line603"></a><div class="linenumber">603</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;[logFields]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple&nbsp;JSON&nbsp;object&nbsp;which&nbsp;contains&nbsp;extra&nbsp;fields&nbsp;to&nbsp;be&nbsp;logged.
<a name="line604"></a><div class="linenumber">604</div><div style="width:0em;display:inline-block"></div>*/
<a name="line605"></a><div class="linenumber">605</div><div style="width:0em;display:inline-block"></div>pub.util.logWarning&nbsp;=&nbsp;function(logText,&nbsp;logFields)&nbsp;{
<a name="line606"></a><div class="linenumber">606</div><div style="width:2em;display:inline-block"></div>pub.util.log("warning",&nbsp;logText,&nbsp;logFields);
<a name="line607"></a><div class="linenumber">607</div><div style="width:0em;display:inline-block"></div>};
<a name="line608"></a><div class="linenumber">608</div><div style="width:0em;display:inline-block"></div>
<a name="line609"></a><div class="linenumber">609</div><div style="width:0em;display:inline-block"></div>
<a name="line610"></a><div class="linenumber">610</div><div style="width:0em;display:inline-block"></div>/**
<a name="line611"></a><div class="linenumber">611</div><div style="width:0em;display:inline-block"></div>*&nbsp;Convenience&nbsp;function&nbsp;for&nbsp;logging&nbsp;"error"&nbsp;level&nbsp;items.
<a name="line612"></a><div class="linenumber">612</div><div style="width:0em;display:inline-block"></div>*
<a name="line613"></a><div class="linenumber">613</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;logText&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;for&nbsp;log.
<a name="line614"></a><div class="linenumber">614</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;[logFields]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple&nbsp;JSON&nbsp;object&nbsp;which&nbsp;contains&nbsp;extra&nbsp;fields&nbsp;to&nbsp;be&nbsp;logged.
<a name="line615"></a><div class="linenumber">615</div><div style="width:0em;display:inline-block"></div>*/
<a name="line616"></a><div class="linenumber">616</div><div style="width:0em;display:inline-block"></div>pub.util.logError&nbsp;=&nbsp;function(logText,&nbsp;logFields)&nbsp;{
<a name="line617"></a><div class="linenumber">617</div><div style="width:2em;display:inline-block"></div>pub.util.log("error",&nbsp;logText,&nbsp;logFields);
<a name="line618"></a><div class="linenumber">618</div><div style="width:0em;display:inline-block"></div>};
<a name="line619"></a><div class="linenumber">619</div><div style="width:0em;display:inline-block"></div>
<a name="line620"></a><div class="linenumber">620</div><div style="width:0em;display:inline-block"></div>
<a name="line621"></a><div class="linenumber">621</div><div style="width:0em;display:inline-block"></div>/**
<a name="line622"></a><div class="linenumber">622</div><div style="width:0em;display:inline-block"></div>*&nbsp;Sends&nbsp;an&nbsp;'ack'&nbsp;socket&nbsp;message&nbsp;to&nbsp;a&nbsp;given&nbsp;socketCallback.&nbsp;Provides&nbsp;additional&nbsp;checking&nbsp;and&nbsp;logging.
<a name="line623"></a><div class="linenumber">623</div><div style="width:0em;display:inline-block"></div>*
<a name="line624"></a><div class="linenumber">624</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;a&nbsp;socket&nbsp;connection.
<a name="line625"></a><div class="linenumber">625</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function
<a name="line626"></a><div class="linenumber">626</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?Object}&nbsp;&nbsp;&nbsp;appObj&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;application&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;an&nbsp;application.
<a name="line627"></a><div class="linenumber">627</div><div style="width:0em;display:inline-block"></div>*/
<a name="line628"></a><div class="linenumber">628</div><div style="width:0em;display:inline-block"></div>pub.util.sendSocketCallbackAck&nbsp;=&nbsp;function(easyrtcid,&nbsp;socketCallback,&nbsp;appObj)&nbsp;{
<a name="line629"></a><div class="linenumber">629</div><div style="width:2em;display:inline-block"></div>return&nbsp;pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;{"msgType":"ack"},&nbsp;appObj);
<a name="line630"></a><div class="linenumber">630</div><div style="width:0em;display:inline-block"></div>};
<a name="line631"></a><div class="linenumber">631</div><div style="width:0em;display:inline-block"></div>
<a name="line632"></a><div class="linenumber">632</div><div style="width:0em;display:inline-block"></div>
<a name="line633"></a><div class="linenumber">633</div><div style="width:0em;display:inline-block"></div>/**
<a name="line634"></a><div class="linenumber">634</div><div style="width:0em;display:inline-block"></div>*&nbsp;Sends&nbsp;a&nbsp;complete&nbsp;socket&nbsp;message&nbsp;to&nbsp;a&nbsp;given&nbsp;socketCallback.&nbsp;Provides&nbsp;additional&nbsp;checking&nbsp;and&nbsp;logging.
<a name="line635"></a><div class="linenumber">635</div><div style="width:0em;display:inline-block"></div>*
<a name="line636"></a><div class="linenumber">636</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;a&nbsp;socket&nbsp;connection.
<a name="line637"></a><div class="linenumber">637</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function
<a name="line638"></a><div class="linenumber">638</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Message&nbsp;object&nbsp;which&nbsp;contains&nbsp;the&nbsp;full&nbsp;message&nbsp;for&nbsp;a&nbsp;client;&nbsp;this&nbsp;can&nbsp;include&nbsp;the&nbsp;standard&nbsp;msgType&nbsp;and&nbsp;msgData&nbsp;fields.
<a name="line639"></a><div class="linenumber">639</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?Object}&nbsp;&nbsp;&nbsp;appObj&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;application&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;an&nbsp;application.
<a name="line640"></a><div class="linenumber">640</div><div style="width:0em;display:inline-block"></div>*/
<a name="line641"></a><div class="linenumber">641</div><div style="width:0em;display:inline-block"></div>pub.util.sendSocketCallbackMsg&nbsp;=&nbsp;function(easyrtcid,&nbsp;socketCallback,&nbsp;msg,&nbsp;appObj)&nbsp;{
<a name="line642"></a><div class="linenumber">642</div><div style="width:2em;display:inline-block"></div>var&nbsp;appName;
<a name="line643"></a><div class="linenumber">643</div><div style="width:0em;display:inline-block"></div>
<a name="line644"></a><div class="linenumber">644</div><div style="width:2em;display:inline-block"></div>if&nbsp;(appObj)&nbsp;{
<a name="line645"></a><div class="linenumber">645</div><div style="width:4em;display:inline-block"></div>appName&nbsp;=&nbsp;appObj.getAppName();
<a name="line646"></a><div class="linenumber">646</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!appObj.isConnectedSync(easyrtcid))&nbsp;{
<a name="line647"></a><div class="linenumber">647</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+appName+"]["+easyrtcid+"]&nbsp;Unable&nbsp;to&nbsp;return&nbsp;socket&nbsp;message.&nbsp;Peer&nbsp;no&nbsp;longer&nbsp;connected.");
<a name="line648"></a><div class="linenumber">648</div><div style="width:6em;display:inline-block"></div>return&nbsp;false;
<a name="line649"></a><div class="linenumber">649</div><div style="width:4em;display:inline-block"></div>}
<a name="line650"></a><div class="linenumber">650</div><div style="width:2em;display:inline-block"></div>}
<a name="line651"></a><div class="linenumber">651</div><div style="width:0em;display:inline-block"></div>
<a name="line652"></a><div class="linenumber">652</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isFunction(socketCallback))&nbsp;{
<a name="line653"></a><div class="linenumber">653</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("["+appName+"]["+easyrtcid+"]&nbsp;Unable&nbsp;to&nbsp;return&nbsp;socket&nbsp;message.&nbsp;Provided&nbsp;socketCallback&nbsp;was&nbsp;not&nbsp;a&nbsp;function.");
<a name="line654"></a><div class="linenumber">654</div><div style="width:4em;display:inline-block"></div>return&nbsp;false;
<a name="line655"></a><div class="linenumber">655</div><div style="width:2em;display:inline-block"></div>}
<a name="line656"></a><div class="linenumber">656</div><div style="width:0em;display:inline-block"></div>
<a name="line657"></a><div class="linenumber">657</div><div style="width:2em;display:inline-block"></div>try&nbsp;{
<a name="line658"></a><div class="linenumber">658</div><div style="width:4em;display:inline-block"></div>socketCallback(msg);
<a name="line659"></a><div class="linenumber">659</div><div style="width:2em;display:inline-block"></div>}&nbsp;catch(err)&nbsp;{
<a name="line660"></a><div class="linenumber">660</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("["+appName+"]["+easyrtcid+"]&nbsp;Unable&nbsp;to&nbsp;return&nbsp;socket&nbsp;message.&nbsp;Call&nbsp;to&nbsp;socketCallback&nbsp;failed.");
<a name="line661"></a><div class="linenumber">661</div><div style="width:2em;display:inline-block"></div>}
<a name="line662"></a><div class="linenumber">662</div><div style="width:0em;display:inline-block"></div>
<a name="line663"></a><div class="linenumber">663</div><div style="width:2em;display:inline-block"></div>if&nbsp;(e.option.logMessagesEnable)&nbsp;{
<a name="line664"></a><div class="linenumber">664</div><div style="width:4em;display:inline-block"></div>try&nbsp;{
<a name="line665"></a><div class="linenumber">665</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+appName+"]["+easyrtcid+"]&nbsp;Returning&nbsp;socket.io&nbsp;message:&nbsp;["+JSON.stringify(msg)+"]");
<a name="line666"></a><div class="linenumber">666</div><div style="width:4em;display:inline-block"></div>}
<a name="line667"></a><div class="linenumber">667</div><div style="width:4em;display:inline-block"></div>catch(err)&nbsp;{
<a name="line668"></a><div class="linenumber">668</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+appName+"]["+easyrtcid+"]&nbsp;Returning&nbsp;socket.io&nbsp;message");
<a name="line669"></a><div class="linenumber">669</div><div style="width:4em;display:inline-block"></div>}
<a name="line670"></a><div class="linenumber">670</div><div style="width:2em;display:inline-block"></div>}
<a name="line671"></a><div class="linenumber">671</div><div style="width:2em;display:inline-block"></div>return&nbsp;true;
<a name="line672"></a><div class="linenumber">672</div><div style="width:0em;display:inline-block"></div>};
<a name="line673"></a><div class="linenumber">673</div><div style="width:0em;display:inline-block"></div>
<a name="line674"></a><div class="linenumber">674</div><div style="width:0em;display:inline-block"></div>/**
<a name="line675"></a><div class="linenumber">675</div><div style="width:0em;display:inline-block"></div>*&nbsp;&nbsp;Checks&nbsp;with&nbsp;EasyRTC&nbsp;site&nbsp;for&nbsp;latest&nbsp;version.&nbsp;Writes&nbsp;to&nbsp;the&nbsp;log&nbsp;if&nbsp;a&nbsp;version&nbsp;can&nbsp;be&nbsp;found.&nbsp;If&nbsp;connection&nbsp;cannot&nbsp;be&nbsp;established&nbsp;than&nbsp;no&nbsp;error&nbsp;will&nbsp;be&nbsp;shown.
<a name="line676"></a><div class="linenumber">676</div><div style="width:0em;display:inline-block"></div>*/
<a name="line677"></a><div class="linenumber">677</div><div style="width:0em;display:inline-block"></div>pub.util.updateCheck&nbsp;=&nbsp;function()&nbsp;{
<a name="line678"></a><div class="linenumber">678</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcVersion&nbsp;=&nbsp;pub.getVersion();
<a name="line679"></a><div class="linenumber">679</div><div style="width:0em;display:inline-block"></div>
<a name="line680"></a><div class="linenumber">680</div><div style="width:2em;display:inline-block"></div>require("http").get("http://easyrtc.com/version/?app=easyrtc&amp;ver="&nbsp;+&nbsp;easyrtcVersion&nbsp;+&nbsp;"&amp;platform="&nbsp;+&nbsp;process.platform&nbsp;+&nbsp;"&amp;nodever="&nbsp;+&nbsp;process.version,&nbsp;function(res)&nbsp;{
<a name="line681"></a><div class="linenumber">681</div><div style="width:4em;display:inline-block"></div>if&nbsp;(res.statusCode&nbsp;==&nbsp;200)
<a name="line682"></a><div class="linenumber">682</div><div style="width:6em;display:inline-block"></div>res.on('data',&nbsp;function(latestVersion)&nbsp;{
<a name="line683"></a><div class="linenumber">683</div><div style="width:8em;display:inline-block"></div>latestVersion&nbsp;=&nbsp;(latestVersion&nbsp;+&nbsp;"").replace(/[^0-9a-z.]/g,&nbsp;"");
<a name="line684"></a><div class="linenumber">684</div><div style="width:8em;display:inline-block"></div>if&nbsp;(latestVersion&nbsp;!=&nbsp;easyrtcVersion)&nbsp;{
<a name="line685"></a><div class="linenumber">685</div><div style="width:10em;display:inline-block"></div>var&nbsp;l&nbsp;=&nbsp;latestVersion.replace(/[^0-9.]/g,&nbsp;"").split(".",&nbsp;3);
<a name="line686"></a><div class="linenumber">686</div><div style="width:10em;display:inline-block"></div>l[0]&nbsp;=&nbsp;parseInt(l[0]);
<a name="line687"></a><div class="linenumber">687</div><div style="width:10em;display:inline-block"></div>l[1]&nbsp;=&nbsp;parseInt(l[1]);
<a name="line688"></a><div class="linenumber">688</div><div style="width:10em;display:inline-block"></div>l[2]&nbsp;=&nbsp;parseInt(l[2]);
<a name="line689"></a><div class="linenumber">689</div><div style="width:10em;display:inline-block"></div>var&nbsp;v&nbsp;=&nbsp;easyrtcVersion.replace(/[^0-9.]/g,&nbsp;"").split(".",&nbsp;3);
<a name="line690"></a><div class="linenumber">690</div><div style="width:10em;display:inline-block"></div>v[0]&nbsp;=&nbsp;parseInt(v[0]);
<a name="line691"></a><div class="linenumber">691</div><div style="width:10em;display:inline-block"></div>v[1]&nbsp;=&nbsp;parseInt(v[1]);
<a name="line692"></a><div class="linenumber">692</div><div style="width:10em;display:inline-block"></div>v[2]&nbsp;=&nbsp;parseInt(v[2]);
<a name="line693"></a><div class="linenumber">693</div><div style="width:10em;display:inline-block"></div>if&nbsp;(v[0]&nbsp;&lt;&nbsp;l[0]&nbsp;||&nbsp;(v[0]&nbsp;==&nbsp;l[0]&nbsp;&amp;&amp;&nbsp;v[1]&nbsp;&lt;&nbsp;l[1])&nbsp;||&nbsp;(v[0]&nbsp;==&nbsp;l[0]&nbsp;&amp;&amp;&nbsp;v[1]&nbsp;==&nbsp;l[1]&nbsp;&amp;&amp;&nbsp;v[2]&nbsp;&lt;&nbsp;l[2]))
<a name="line694"></a><div class="linenumber">694</div><div style="width:12em;display:inline-block"></div>pub.util.logWarning("Update&nbsp;Check:&nbsp;New&nbsp;version&nbsp;of&nbsp;EasyRTC&nbsp;is&nbsp;available&nbsp;("&nbsp;+&nbsp;latestVersion&nbsp;+&nbsp;").&nbsp;Visit&nbsp;http://easyrtc.com/&nbsp;for&nbsp;details&nbsp;or&nbsp;run&nbsp;'npm&nbsp;update'&nbsp;to&nbsp;upgrade.");
<a name="line695"></a><div class="linenumber">695</div><div style="width:10em;display:inline-block"></div>else&nbsp;if&nbsp;(v[0]&nbsp;==&nbsp;l[0]&nbsp;&amp;&amp;&nbsp;v[1]&nbsp;==&nbsp;l[1]&nbsp;&amp;&amp;&nbsp;v[2]&nbsp;==&nbsp;l[2]&nbsp;&amp;&amp;&nbsp;easyrtcVersion.replace(/[^a-z]/gi,&nbsp;"")&nbsp;!=&nbsp;"")
<a name="line696"></a><div class="linenumber">696</div><div style="width:12em;display:inline-block"></div>pub.util.logWarning("Update&nbsp;Check:&nbsp;New&nbsp;non-beta&nbsp;version&nbsp;of&nbsp;EasyRTC&nbsp;is&nbsp;available&nbsp;("&nbsp;+&nbsp;latestVersion&nbsp;+&nbsp;").&nbsp;Visit&nbsp;http://easyrtc.com/&nbsp;for&nbsp;details.");
<a name="line697"></a><div class="linenumber">697</div><div style="width:8em;display:inline-block"></div>}
<a name="line698"></a><div class="linenumber">698</div><div style="width:6em;display:inline-block"></div>});
<a name="line699"></a><div class="linenumber">699</div><div style="width:2em;display:inline-block"></div>}).on('error',&nbsp;function(e)&nbsp;{
<a name="line700"></a><div class="linenumber">700</div><div style="width:2em;display:inline-block"></div>});
<a name="line701"></a><div class="linenumber">701</div><div style="width:0em;display:inline-block"></div>};
<a name="line702"></a><div class="linenumber">702</div><div style="width:0em;display:inline-block"></div>
<a name="line703"></a><div class="linenumber">703</div><div style="width:0em;display:inline-block"></div>
<a name="line704"></a><div class="linenumber">704</div><div style="width:0em;display:inline-block"></div>/**
<a name="line705"></a><div class="linenumber">705</div><div style="width:0em;display:inline-block"></div>*&nbsp;Checks&nbsp;an&nbsp;incoming&nbsp;EasyRTC&nbsp;message&nbsp;to&nbsp;determine&nbsp;if&nbsp;it&nbsp;is&nbsp;syntactically&nbsp;valid.
<a name="line706"></a><div class="linenumber">706</div><div style="width:0em;display:inline-block"></div>*
<a name="line707"></a><div class="linenumber">707</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;Socket.IO&nbsp;message&nbsp;type.&nbsp;Expected&nbsp;values&nbsp;are&nbsp;(easyrtcAuth|easyrtcCmd|easyrtcMsg)
<a name="line708"></a><div class="linenumber">708</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Message&nbsp;object&nbsp;which&nbsp;contains&nbsp;the&nbsp;full&nbsp;message&nbsp;from&nbsp;a&nbsp;client;&nbsp;this&nbsp;can&nbsp;include&nbsp;the&nbsp;standard&nbsp;msgType&nbsp;and&nbsp;msgData&nbsp;fields.
<a name="line709"></a><div class="linenumber">709</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?Object}&nbsp;appObj&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;application&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;an&nbsp;application.
<a name="line710"></a><div class="linenumber">710</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;boolean,&nbsp;string)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error,&nbsp;a&nbsp;boolean&nbsp;of&nbsp;whether&nbsp;message&nbsp;if&nbsp;valid,&nbsp;and&nbsp;a&nbsp;string&nbsp;indicating&nbsp;the&nbsp;error&nbsp;code&nbsp;if&nbsp;the&nbsp;message&nbsp;is&nbsp;invalid.
<a name="line711"></a><div class="linenumber">711</div><div style="width:0em;display:inline-block"></div>*/
<a name="line712"></a><div class="linenumber">712</div><div style="width:0em;display:inline-block"></div>pub.util.isValidIncomingMessage&nbsp;=&nbsp;function(type,&nbsp;msg,&nbsp;appObj,&nbsp;callback)&nbsp;{
<a name="line713"></a><div class="linenumber">713</div><div style="width:2em;display:inline-block"></div>//&nbsp;A&nbsp;generic&nbsp;getOption&nbsp;variable&nbsp;which&nbsp;points&nbsp;to&nbsp;the&nbsp;getOption&nbsp;function&nbsp;at&nbsp;either&nbsp;the&nbsp;top&nbsp;or&nbsp;application&nbsp;level
<a name="line714"></a><div class="linenumber">714</div><div style="width:2em;display:inline-block"></div>var&nbsp;getOption&nbsp;=&nbsp;(_.isObject(appObj)&nbsp;?&nbsp;appObj.getOption&nbsp;:&nbsp;pub.getOption);
<a name="line715"></a><div class="linenumber">715</div><div style="width:0em;display:inline-block"></div>
<a name="line716"></a><div class="linenumber">716</div><div style="width:2em;display:inline-block"></div>//&nbsp;All&nbsp;messages&nbsp;follow&nbsp;the&nbsp;basic&nbsp;structure
<a name="line717"></a><div class="linenumber">717</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isString(type))&nbsp;{
<a name="line718"></a><div class="linenumber">718</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_TYPE");
<a name="line719"></a><div class="linenumber">719</div><div style="width:4em;display:inline-block"></div>return;
<a name="line720"></a><div class="linenumber">720</div><div style="width:2em;display:inline-block"></div>}
<a name="line721"></a><div class="linenumber">721</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isObject(msg))&nbsp;{
<a name="line722"></a><div class="linenumber">722</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line723"></a><div class="linenumber">723</div><div style="width:4em;display:inline-block"></div>return;
<a name="line724"></a><div class="linenumber">724</div><div style="width:2em;display:inline-block"></div>}
<a name="line725"></a><div class="linenumber">725</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isString(msg.msgType))&nbsp;{
<a name="line726"></a><div class="linenumber">726</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_TYPE");
<a name="line727"></a><div class="linenumber">727</div><div style="width:4em;display:inline-block"></div>return;
<a name="line728"></a><div class="linenumber">728</div><div style="width:2em;display:inline-block"></div>}
<a name="line729"></a><div class="linenumber">729</div><div style="width:0em;display:inline-block"></div>
<a name="line730"></a><div class="linenumber">730</div><div style="width:2em;display:inline-block"></div>switch&nbsp;(type)&nbsp;{
<a name="line731"></a><div class="linenumber">731</div><div style="width:4em;display:inline-block"></div>case&nbsp;"easyrtcAuth":
<a name="line732"></a><div class="linenumber">732</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.msgType&nbsp;!=&nbsp;"authenticate")&nbsp;{
<a name="line733"></a><div class="linenumber">733</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_TYPE");
<a name="line734"></a><div class="linenumber">734</div><div style="width:8em;display:inline-block"></div>return;
<a name="line735"></a><div class="linenumber">735</div><div style="width:6em;display:inline-block"></div>}
<a name="line736"></a><div class="linenumber">736</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData))&nbsp;{
<a name="line737"></a><div class="linenumber">737</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_DATA");
<a name="line738"></a><div class="linenumber">738</div><div style="width:8em;display:inline-block"></div>return;
<a name="line739"></a><div class="linenumber">739</div><div style="width:6em;display:inline-block"></div>}
<a name="line740"></a><div class="linenumber">740</div><div style="width:0em;display:inline-block"></div>
<a name="line741"></a><div class="linenumber">741</div><div style="width:6em;display:inline-block"></div>//&nbsp;msgData.apiVersion&nbsp;(required)
<a name="line742"></a><div class="linenumber">742</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.msgData.apiVersion&nbsp;===&nbsp;undefined&nbsp;||&nbsp;!_.isString(msg.msgData.apiVersion)&nbsp;||&nbsp;!getOption("apiVersionRegExp").test(msg.msgData.apiVersion))&nbsp;{
<a name="line743"></a><div class="linenumber">743</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line744"></a><div class="linenumber">744</div><div style="width:8em;display:inline-block"></div>return;
<a name="line745"></a><div class="linenumber">745</div><div style="width:6em;display:inline-block"></div>}
<a name="line746"></a><div class="linenumber">746</div><div style="width:0em;display:inline-block"></div>
<a name="line747"></a><div class="linenumber">747</div><div style="width:6em;display:inline-block"></div>//&nbsp;msgData.appName
<a name="line748"></a><div class="linenumber">748</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.msgData.applicationName&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isString(msg.msgData.applicationName)&nbsp;||&nbsp;!getOption("appNameRegExp").test(msg.msgData.applicationName)))&nbsp;{
<a name="line749"></a><div class="linenumber">749</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line750"></a><div class="linenumber">750</div><div style="width:8em;display:inline-block"></div>return;
<a name="line751"></a><div class="linenumber">751</div><div style="width:6em;display:inline-block"></div>}
<a name="line752"></a><div class="linenumber">752</div><div style="width:0em;display:inline-block"></div>
<a name="line753"></a><div class="linenumber">753</div><div style="width:6em;display:inline-block"></div>//&nbsp;msgData.easyrtcsid
<a name="line754"></a><div class="linenumber">754</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.msgData.easyrtcsid&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isString(msg.msgData.easyrtcsid)&nbsp;||&nbsp;!getOption("easyrtcsidRegExp").test(msg.msgData.easyrtcsid)))&nbsp;{
<a name="line755"></a><div class="linenumber">755</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line756"></a><div class="linenumber">756</div><div style="width:8em;display:inline-block"></div>return;
<a name="line757"></a><div class="linenumber">757</div><div style="width:6em;display:inline-block"></div>}
<a name="line758"></a><div class="linenumber">758</div><div style="width:0em;display:inline-block"></div>
<a name="line759"></a><div class="linenumber">759</div><div style="width:6em;display:inline-block"></div>var&nbsp;isCallbackRun&nbsp;=&nbsp;false;
<a name="line760"></a><div class="linenumber">760</div><div style="width:6em;display:inline-block"></div>async.waterfall([
<a name="line761"></a><div class="linenumber">761</div><div style="width:8em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line762"></a><div class="linenumber">762</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!appObj)&nbsp;{
<a name="line763"></a><div class="linenumber">763</div><div style="width:12em;display:inline-block"></div>pub.app((msg.msgData.applicationName&nbsp;!==&nbsp;undefined&nbsp;?&nbsp;msg.msgData.applicationName&nbsp;:&nbsp;getOption("appDefaultName")),&nbsp;function(err,&nbsp;newAppObj)&nbsp;{
<a name="line764"></a><div class="linenumber">764</div><div style="width:14em;display:inline-block"></div>if&nbsp;(!err)&nbsp;{
<a name="line765"></a><div class="linenumber">765</div><div style="width:16em;display:inline-block"></div>appObj&nbsp;=&nbsp;newAppObj;
<a name="line766"></a><div class="linenumber">766</div><div style="width:16em;display:inline-block"></div>getOption&nbsp;=&nbsp;appObj.getOption;
<a name="line767"></a><div class="linenumber">767</div><div style="width:14em;display:inline-block"></div>}
<a name="line768"></a><div class="linenumber">768</div><div style="width:14em;display:inline-block"></div>asyncCallback(null);
<a name="line769"></a><div class="linenumber">769</div><div style="width:12em;display:inline-block"></div>});
<a name="line770"></a><div class="linenumber">770</div><div style="width:10em;display:inline-block"></div>}
<a name="line771"></a><div class="linenumber">771</div><div style="width:10em;display:inline-block"></div>else&nbsp;{
<a name="line772"></a><div class="linenumber">772</div><div style="width:12em;display:inline-block"></div>asyncCallback(null);
<a name="line773"></a><div class="linenumber">773</div><div style="width:10em;display:inline-block"></div>}
<a name="line774"></a><div class="linenumber">774</div><div style="width:8em;display:inline-block"></div>},
<a name="line775"></a><div class="linenumber">775</div><div style="width:8em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line776"></a><div class="linenumber">776</div><div style="width:10em;display:inline-block"></div>//&nbsp;msgData.username
<a name="line777"></a><div class="linenumber">777</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData.username&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isString(msg.msgData.username)&nbsp;||&nbsp;!getOption("usernameRegExp").test(msg.msgData.username)))&nbsp;{
<a name="line778"></a><div class="linenumber">778</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line779"></a><div class="linenumber">779</div><div style="width:12em;display:inline-block"></div>isCallbackRun&nbsp;=&nbsp;true;
<a name="line780"></a><div class="linenumber">780</div><div style="width:12em;display:inline-block"></div>return;
<a name="line781"></a><div class="linenumber">781</div><div style="width:10em;display:inline-block"></div>}
<a name="line782"></a><div class="linenumber">782</div><div style="width:0em;display:inline-block"></div>
<a name="line783"></a><div class="linenumber">783</div><div style="width:10em;display:inline-block"></div>//&nbsp;msgData.credential
<a name="line784"></a><div class="linenumber">784</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData.credential&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isObject(msg.msgData.credential)&nbsp;||&nbsp;_.isEmpty(msg.msgData.credential)))&nbsp;{
<a name="line785"></a><div class="linenumber">785</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line786"></a><div class="linenumber">786</div><div style="width:12em;display:inline-block"></div>isCallbackRun&nbsp;=&nbsp;true;
<a name="line787"></a><div class="linenumber">787</div><div style="width:12em;display:inline-block"></div>return;
<a name="line788"></a><div class="linenumber">788</div><div style="width:10em;display:inline-block"></div>}
<a name="line789"></a><div class="linenumber">789</div><div style="width:0em;display:inline-block"></div>
<a name="line790"></a><div class="linenumber">790</div><div style="width:10em;display:inline-block"></div>//&nbsp;msgData.roomJoin
<a name="line791"></a><div class="linenumber">791</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData.roomJoin&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line792"></a><div class="linenumber">792</div><div style="width:12em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData.roomJoin))&nbsp;{
<a name="line793"></a><div class="linenumber">793</div><div style="width:14em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line794"></a><div class="linenumber">794</div><div style="width:14em;display:inline-block"></div>isCallbackRun&nbsp;=&nbsp;true;
<a name="line795"></a><div class="linenumber">795</div><div style="width:14em;display:inline-block"></div>return;
<a name="line796"></a><div class="linenumber">796</div><div style="width:12em;display:inline-block"></div>}
<a name="line797"></a><div class="linenumber">797</div><div style="width:0em;display:inline-block"></div>
<a name="line798"></a><div class="linenumber">798</div><div style="width:12em;display:inline-block"></div>for&nbsp;(var&nbsp;currentRoomName&nbsp;in&nbsp;msg.msgData.roomJoin)&nbsp;{
<a name="line799"></a><div class="linenumber">799</div><div style="width:14em;display:inline-block"></div>if&nbsp;(!getOption("roomNameRegExp").test(currentRoomName)&nbsp;||&nbsp;!_.isObject(msg.msgData.roomJoin[currentRoomName])&nbsp;||&nbsp;!_.isString(msg.msgData.roomJoin[currentRoomName].roomName)&nbsp;||&nbsp;currentRoomName&nbsp;!=&nbsp;msg.msgData.roomJoin[currentRoomName].roomName)&nbsp;{
<a name="line800"></a><div class="linenumber">800</div><div style="width:16em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line801"></a><div class="linenumber">801</div><div style="width:16em;display:inline-block"></div>isCallbackRun&nbsp;=&nbsp;true;
<a name="line802"></a><div class="linenumber">802</div><div style="width:16em;display:inline-block"></div>return;
<a name="line803"></a><div class="linenumber">803</div><div style="width:14em;display:inline-block"></div>}
<a name="line804"></a><div class="linenumber">804</div><div style="width:14em;display:inline-block"></div>//&nbsp;if&nbsp;roomParameter&nbsp;field&nbsp;is&nbsp;defined,&nbsp;it&nbsp;must&nbsp;be&nbsp;an&nbsp;object
<a name="line805"></a><div class="linenumber">805</div><div style="width:14em;display:inline-block"></div>if&nbsp;(msg.msgData.roomJoin[currentRoomName].roomParameter&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;!_.isObject(msg.msgData.roomJoin[currentRoomName].roomParameter))&nbsp;{
<a name="line806"></a><div class="linenumber">806</div><div style="width:16em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line807"></a><div class="linenumber">807</div><div style="width:16em;display:inline-block"></div>isCallbackRun&nbsp;=&nbsp;true;
<a name="line808"></a><div class="linenumber">808</div><div style="width:16em;display:inline-block"></div>return;
<a name="line809"></a><div class="linenumber">809</div><div style="width:14em;display:inline-block"></div>}
<a name="line810"></a><div class="linenumber">810</div><div style="width:12em;display:inline-block"></div>}
<a name="line811"></a><div class="linenumber">811</div><div style="width:10em;display:inline-block"></div>}
<a name="line812"></a><div class="linenumber">812</div><div style="width:0em;display:inline-block"></div>
<a name="line813"></a><div class="linenumber">813</div><div style="width:10em;display:inline-block"></div>//&nbsp;msgData.setPresence
<a name="line814"></a><div class="linenumber">814</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData.setPresence&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line815"></a><div class="linenumber">815</div><div style="width:12em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData.setPresence)&nbsp;||&nbsp;_.isEmpty(msg.msgData.setPresence))&nbsp;{
<a name="line816"></a><div class="linenumber">816</div><div style="width:14em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line817"></a><div class="linenumber">817</div><div style="width:14em;display:inline-block"></div>isCallbackRun&nbsp;=&nbsp;true;
<a name="line818"></a><div class="linenumber">818</div><div style="width:14em;display:inline-block"></div>return;
<a name="line819"></a><div class="linenumber">819</div><div style="width:12em;display:inline-block"></div>}
<a name="line820"></a><div class="linenumber">820</div><div style="width:12em;display:inline-block"></div>if&nbsp;(msg.msgData.setPresence.show&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isString(msg.msgData.setPresence.show)&nbsp;||&nbsp;!getOption("presenceShowRegExp").test(msg.msgData.setPresence.show)))&nbsp;{
<a name="line821"></a><div class="linenumber">821</div><div style="width:14em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line822"></a><div class="linenumber">822</div><div style="width:14em;display:inline-block"></div>isCallbackRun&nbsp;=&nbsp;true;
<a name="line823"></a><div class="linenumber">823</div><div style="width:14em;display:inline-block"></div>return;
<a name="line824"></a><div class="linenumber">824</div><div style="width:12em;display:inline-block"></div>}
<a name="line825"></a><div class="linenumber">825</div><div style="width:12em;display:inline-block"></div>if&nbsp;(msg.msgData.setPresence.status&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isString(msg.msgData.setPresence.status)&nbsp;||&nbsp;!getOption("presenceStatusRegExp").test(msg.msgData.setPresence.status)))&nbsp;{
<a name="line826"></a><div class="linenumber">826</div><div style="width:14em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line827"></a><div class="linenumber">827</div><div style="width:14em;display:inline-block"></div>isCallbackRun&nbsp;=&nbsp;true;
<a name="line828"></a><div class="linenumber">828</div><div style="width:14em;display:inline-block"></div>return;
<a name="line829"></a><div class="linenumber">829</div><div style="width:12em;display:inline-block"></div>}
<a name="line830"></a><div class="linenumber">830</div><div style="width:10em;display:inline-block"></div>}
<a name="line831"></a><div class="linenumber">831</div><div style="width:0em;display:inline-block"></div>
<a name="line832"></a><div class="linenumber">832</div><div style="width:10em;display:inline-block"></div>//&nbsp;TODO:&nbsp;setUserCfg
<a name="line833"></a><div class="linenumber">833</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData.setUserCfg&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line834"></a><div class="linenumber">834</div><div style="width:10em;display:inline-block"></div>}
<a name="line835"></a><div class="linenumber">835</div><div style="width:10em;display:inline-block"></div>asyncCallback(null);
<a name="line836"></a><div class="linenumber">836</div><div style="width:0em;display:inline-block"></div>
<a name="line837"></a><div class="linenumber">837</div><div style="width:8em;display:inline-block"></div>}
<a name="line838"></a><div class="linenumber">838</div><div style="width:6em;display:inline-block"></div>],
<a name="line839"></a><div class="linenumber">839</div><div style="width:10em;display:inline-block"></div>function(err)&nbsp;{
<a name="line840"></a><div class="linenumber">840</div><div style="width:12em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line841"></a><div class="linenumber">841</div><div style="width:14em;display:inline-block"></div>if&nbsp;(!isCallbackRun)&nbsp;{
<a name="line842"></a><div class="linenumber">842</div><div style="width:16em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line843"></a><div class="linenumber">843</div><div style="width:16em;display:inline-block"></div>isCallbackRun&nbsp;=&nbsp;true;
<a name="line844"></a><div class="linenumber">844</div><div style="width:14em;display:inline-block"></div>}
<a name="line845"></a><div class="linenumber">845</div><div style="width:12em;display:inline-block"></div>}
<a name="line846"></a><div class="linenumber">846</div><div style="width:12em;display:inline-block"></div>else&nbsp;{
<a name="line847"></a><div class="linenumber">847</div><div style="width:14em;display:inline-block"></div>//&nbsp;Incoming&nbsp;message&nbsp;syntactically&nbsp;valid
<a name="line848"></a><div class="linenumber">848</div><div style="width:14em;display:inline-block"></div>callback(null,&nbsp;true,&nbsp;null);
<a name="line849"></a><div class="linenumber">849</div><div style="width:12em;display:inline-block"></div>}
<a name="line850"></a><div class="linenumber">850</div><div style="width:10em;display:inline-block"></div>}
<a name="line851"></a><div class="linenumber">851</div><div style="width:6em;display:inline-block"></div>);
<a name="line852"></a><div class="linenumber">852</div><div style="width:0em;display:inline-block"></div>
<a name="line853"></a><div class="linenumber">853</div><div style="width:6em;display:inline-block"></div>return;
<a name="line854"></a><div class="linenumber">854</div><div style="width:6em;display:inline-block"></div>break;
<a name="line855"></a><div class="linenumber">855</div><div style="width:0em;display:inline-block"></div>
<a name="line856"></a><div class="linenumber">856</div><div style="width:4em;display:inline-block"></div>case&nbsp;"easyrtcCmd":
<a name="line857"></a><div class="linenumber">857</div><div style="width:6em;display:inline-block"></div>switch&nbsp;(msg.msgType)&nbsp;{
<a name="line858"></a><div class="linenumber">858</div><div style="width:8em;display:inline-block"></div>case&nbsp;"candidate"&nbsp;:
<a name="line859"></a><div class="linenumber">859</div><div style="width:8em;display:inline-block"></div>case&nbsp;"offer"&nbsp;:
<a name="line860"></a><div class="linenumber">860</div><div style="width:8em;display:inline-block"></div>case&nbsp;"answer"&nbsp;:
<a name="line861"></a><div class="linenumber">861</div><div style="width:10em;display:inline-block"></div>//&nbsp;candidate,&nbsp;offer,&nbsp;and&nbsp;answer&nbsp;each&nbsp;require&nbsp;a&nbsp;non-empty&nbsp;msgData&nbsp;object&nbsp;and&nbsp;a&nbsp;proper&nbsp;targetEasyrtcid
<a name="line862"></a><div class="linenumber">862</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData)&nbsp;||&nbsp;_.isEmpty(msg.msgData))&nbsp;{
<a name="line863"></a><div class="linenumber">863</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_DATA");
<a name="line864"></a><div class="linenumber">864</div><div style="width:12em;display:inline-block"></div>return;
<a name="line865"></a><div class="linenumber">865</div><div style="width:10em;display:inline-block"></div>}
<a name="line866"></a><div class="linenumber">866</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isString(msg.targetEasyrtcid)&nbsp;||&nbsp;!getOption("easyrtcidRegExp").test(msg.targetEasyrtcid))&nbsp;{
<a name="line867"></a><div class="linenumber">867</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line868"></a><div class="linenumber">868</div><div style="width:12em;display:inline-block"></div>return;
<a name="line869"></a><div class="linenumber">869</div><div style="width:10em;display:inline-block"></div>}
<a name="line870"></a><div class="linenumber">870</div><div style="width:10em;display:inline-block"></div>break;
<a name="line871"></a><div class="linenumber">871</div><div style="width:8em;display:inline-block"></div>case&nbsp;"reject"&nbsp;:
<a name="line872"></a><div class="linenumber">872</div><div style="width:8em;display:inline-block"></div>case&nbsp;"hangup"&nbsp;:
<a name="line873"></a><div class="linenumber">873</div><div style="width:10em;display:inline-block"></div>//&nbsp;reject,&nbsp;and&nbsp;hangup&nbsp;each&nbsp;require&nbsp;a&nbsp;targetEasyrtcid&nbsp;but&nbsp;no&nbsp;msgData
<a name="line874"></a><div class="linenumber">874</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line875"></a><div class="linenumber">875</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_DATA");
<a name="line876"></a><div class="linenumber">876</div><div style="width:12em;display:inline-block"></div>return;
<a name="line877"></a><div class="linenumber">877</div><div style="width:10em;display:inline-block"></div>}
<a name="line878"></a><div class="linenumber">878</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isString(msg.targetEasyrtcid)&nbsp;||&nbsp;!getOption("easyrtcidRegExp").test(msg.targetEasyrtcid))&nbsp;{
<a name="line879"></a><div class="linenumber">879</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line880"></a><div class="linenumber">880</div><div style="width:12em;display:inline-block"></div>return;
<a name="line881"></a><div class="linenumber">881</div><div style="width:10em;display:inline-block"></div>}
<a name="line882"></a><div class="linenumber">882</div><div style="width:10em;display:inline-block"></div>break;
<a name="line883"></a><div class="linenumber">883</div><div style="width:0em;display:inline-block"></div>
<a name="line884"></a><div class="linenumber">884</div><div style="width:8em;display:inline-block"></div>case&nbsp;"getIceConfig"&nbsp;:
<a name="line885"></a><div class="linenumber">885</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;!_.isEmpty(msg.msgData))&nbsp;{
<a name="line886"></a><div class="linenumber">886</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_DATA");
<a name="line887"></a><div class="linenumber">887</div><div style="width:12em;display:inline-block"></div>return;
<a name="line888"></a><div class="linenumber">888</div><div style="width:10em;display:inline-block"></div>}
<a name="line889"></a><div class="linenumber">889</div><div style="width:10em;display:inline-block"></div>break;
<a name="line890"></a><div class="linenumber">890</div><div style="width:0em;display:inline-block"></div>
<a name="line891"></a><div class="linenumber">891</div><div style="width:8em;display:inline-block"></div>case&nbsp;"getRoomList"&nbsp;:
<a name="line892"></a><div class="linenumber">892</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line893"></a><div class="linenumber">893</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_DATA");
<a name="line894"></a><div class="linenumber">894</div><div style="width:12em;display:inline-block"></div>return;
<a name="line895"></a><div class="linenumber">895</div><div style="width:10em;display:inline-block"></div>}
<a name="line896"></a><div class="linenumber">896</div><div style="width:10em;display:inline-block"></div>break;
<a name="line897"></a><div class="linenumber">897</div><div style="width:0em;display:inline-block"></div>
<a name="line898"></a><div class="linenumber">898</div><div style="width:8em;display:inline-block"></div>case&nbsp;"roomJoin"&nbsp;:
<a name="line899"></a><div class="linenumber">899</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData))&nbsp;{
<a name="line900"></a><div class="linenumber">900</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_DATA");
<a name="line901"></a><div class="linenumber">901</div><div style="width:12em;display:inline-block"></div>return;
<a name="line902"></a><div class="linenumber">902</div><div style="width:10em;display:inline-block"></div>}
<a name="line903"></a><div class="linenumber">903</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData.roomJoin))&nbsp;{
<a name="line904"></a><div class="linenumber">904</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line905"></a><div class="linenumber">905</div><div style="width:12em;display:inline-block"></div>return;
<a name="line906"></a><div class="linenumber">906</div><div style="width:10em;display:inline-block"></div>}
<a name="line907"></a><div class="linenumber">907</div><div style="width:0em;display:inline-block"></div>
<a name="line908"></a><div class="linenumber">908</div><div style="width:10em;display:inline-block"></div>for&nbsp;(var&nbsp;currentRoomName&nbsp;in&nbsp;msg.msgData.roomJoin)&nbsp;{
<a name="line909"></a><div class="linenumber">909</div><div style="width:12em;display:inline-block"></div>if&nbsp;(!getOption("roomNameRegExp").test(currentRoomName)&nbsp;||&nbsp;!_.isObject(msg.msgData.roomJoin[currentRoomName])&nbsp;||&nbsp;!_.isString(msg.msgData.roomJoin[currentRoomName].roomName)&nbsp;||&nbsp;currentRoomName&nbsp;!=&nbsp;msg.msgData.roomJoin[currentRoomName].roomName)&nbsp;{
<a name="line910"></a><div class="linenumber">910</div><div style="width:14em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line911"></a><div class="linenumber">911</div><div style="width:14em;display:inline-block"></div>return;
<a name="line912"></a><div class="linenumber">912</div><div style="width:12em;display:inline-block"></div>}
<a name="line913"></a><div class="linenumber">913</div><div style="width:10em;display:inline-block"></div>}
<a name="line914"></a><div class="linenumber">914</div><div style="width:10em;display:inline-block"></div>break;
<a name="line915"></a><div class="linenumber">915</div><div style="width:0em;display:inline-block"></div>
<a name="line916"></a><div class="linenumber">916</div><div style="width:8em;display:inline-block"></div>case&nbsp;"roomLeave"&nbsp;:
<a name="line917"></a><div class="linenumber">917</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData))&nbsp;{
<a name="line918"></a><div class="linenumber">918</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_DATA");
<a name="line919"></a><div class="linenumber">919</div><div style="width:12em;display:inline-block"></div>return;
<a name="line920"></a><div class="linenumber">920</div><div style="width:10em;display:inline-block"></div>}
<a name="line921"></a><div class="linenumber">921</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData.roomLeave))&nbsp;{
<a name="line922"></a><div class="linenumber">922</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line923"></a><div class="linenumber">923</div><div style="width:12em;display:inline-block"></div>return;
<a name="line924"></a><div class="linenumber">924</div><div style="width:10em;display:inline-block"></div>}
<a name="line925"></a><div class="linenumber">925</div><div style="width:0em;display:inline-block"></div>
<a name="line926"></a><div class="linenumber">926</div><div style="width:10em;display:inline-block"></div>for&nbsp;(var&nbsp;currentRoomName&nbsp;in&nbsp;msg.msgData.roomLeave)&nbsp;{
<a name="line927"></a><div class="linenumber">927</div><div style="width:12em;display:inline-block"></div>if&nbsp;(!getOption("roomNameRegExp").test(currentRoomName)&nbsp;||&nbsp;!_.isObject(msg.msgData.roomLeave[currentRoomName])&nbsp;||&nbsp;!_.isString(msg.msgData.roomLeave[currentRoomName].roomName)&nbsp;||&nbsp;currentRoomName&nbsp;!=&nbsp;msg.msgData.roomLeave[currentRoomName].roomName)&nbsp;{
<a name="line928"></a><div class="linenumber">928</div><div style="width:14em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line929"></a><div class="linenumber">929</div><div style="width:14em;display:inline-block"></div>return;
<a name="line930"></a><div class="linenumber">930</div><div style="width:12em;display:inline-block"></div>}
<a name="line931"></a><div class="linenumber">931</div><div style="width:10em;display:inline-block"></div>}
<a name="line932"></a><div class="linenumber">932</div><div style="width:10em;display:inline-block"></div>break;
<a name="line933"></a><div class="linenumber">933</div><div style="width:0em;display:inline-block"></div>
<a name="line934"></a><div class="linenumber">934</div><div style="width:8em;display:inline-block"></div>case&nbsp;"setPresence"&nbsp;:
<a name="line935"></a><div class="linenumber">935</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData))&nbsp;{
<a name="line936"></a><div class="linenumber">936</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_DATA");
<a name="line937"></a><div class="linenumber">937</div><div style="width:12em;display:inline-block"></div>return;
<a name="line938"></a><div class="linenumber">938</div><div style="width:10em;display:inline-block"></div>}
<a name="line939"></a><div class="linenumber">939</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData.setPresence)&nbsp;||&nbsp;_.isEmpty(msg.msgData.setPresence))&nbsp;{
<a name="line940"></a><div class="linenumber">940</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line941"></a><div class="linenumber">941</div><div style="width:12em;display:inline-block"></div>return;
<a name="line942"></a><div class="linenumber">942</div><div style="width:10em;display:inline-block"></div>}
<a name="line943"></a><div class="linenumber">943</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData.setPresence.show&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isString(msg.msgData.setPresence.show)&nbsp;||&nbsp;!getOption("presenceShowRegExp").test(msg.msgData.setPresence.show)))&nbsp;{
<a name="line944"></a><div class="linenumber">944</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line945"></a><div class="linenumber">945</div><div style="width:12em;display:inline-block"></div>return;
<a name="line946"></a><div class="linenumber">946</div><div style="width:10em;display:inline-block"></div>}
<a name="line947"></a><div class="linenumber">947</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData.setPresence.status&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isString(msg.msgData.setPresence.status)&nbsp;||&nbsp;!getOption("presenceStatusRegExp").test(msg.msgData.setPresence.status)))&nbsp;{
<a name="line948"></a><div class="linenumber">948</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line949"></a><div class="linenumber">949</div><div style="width:12em;display:inline-block"></div>return;
<a name="line950"></a><div class="linenumber">950</div><div style="width:10em;display:inline-block"></div>}
<a name="line951"></a><div class="linenumber">951</div><div style="width:10em;display:inline-block"></div>break;
<a name="line952"></a><div class="linenumber">952</div><div style="width:0em;display:inline-block"></div>
<a name="line953"></a><div class="linenumber">953</div><div style="width:8em;display:inline-block"></div>case&nbsp;"setRoomApiField"&nbsp;:
<a name="line954"></a><div class="linenumber">954</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData))&nbsp;{
<a name="line955"></a><div class="linenumber">955</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_DATA");
<a name="line956"></a><div class="linenumber">956</div><div style="width:12em;display:inline-block"></div>return;
<a name="line957"></a><div class="linenumber">957</div><div style="width:10em;display:inline-block"></div>}
<a name="line958"></a><div class="linenumber">958</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData.setRoomApiField)&nbsp;||&nbsp;_.isEmpty(msg.msgData.setRoomApiField))&nbsp;{
<a name="line959"></a><div class="linenumber">959</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line960"></a><div class="linenumber">960</div><div style="width:12em;display:inline-block"></div>return;
<a name="line961"></a><div class="linenumber">961</div><div style="width:10em;display:inline-block"></div>}
<a name="line962"></a><div class="linenumber">962</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isString(msg.msgData.setRoomApiField.roomName)&nbsp;||&nbsp;!getOption("roomNameRegExp").test(msg.msgData.setRoomApiField.roomName))&nbsp;{
<a name="line963"></a><div class="linenumber">963</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_ROOM");
<a name="line964"></a><div class="linenumber">964</div><div style="width:12em;display:inline-block"></div>return;
<a name="line965"></a><div class="linenumber">965</div><div style="width:10em;display:inline-block"></div>}
<a name="line966"></a><div class="linenumber">966</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData.setRoomApiField.field&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line967"></a><div class="linenumber">967</div><div style="width:12em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData.setRoomApiField.field))&nbsp;{
<a name="line968"></a><div class="linenumber">968</div><div style="width:14em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line969"></a><div class="linenumber">969</div><div style="width:14em;display:inline-block"></div>return;
<a name="line970"></a><div class="linenumber">970</div><div style="width:12em;display:inline-block"></div>}
<a name="line971"></a><div class="linenumber">971</div><div style="width:12em;display:inline-block"></div>try&nbsp;{
<a name="line972"></a><div class="linenumber">972</div><div style="width:14em;display:inline-block"></div>if&nbsp;(JSON.stringify(msg.msgData.setRoomApiField.field).length&nbsp;&gt;=&nbsp;4096)&nbsp;{
<a name="line973"></a><div class="linenumber">973</div><div style="width:16em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_SIZE");
<a name="line974"></a><div class="linenumber">974</div><div style="width:16em;display:inline-block"></div>return;
<a name="line975"></a><div class="linenumber">975</div><div style="width:14em;display:inline-block"></div>}
<a name="line976"></a><div class="linenumber">976</div><div style="width:12em;display:inline-block"></div>}&nbsp;catch&nbsp;(e)&nbsp;{
<a name="line977"></a><div class="linenumber">977</div><div style="width:14em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData.setRoomApiField.field))&nbsp;{
<a name="line978"></a><div class="linenumber">978</div><div style="width:16em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line979"></a><div class="linenumber">979</div><div style="width:16em;display:inline-block"></div>return;
<a name="line980"></a><div class="linenumber">980</div><div style="width:14em;display:inline-block"></div>}
<a name="line981"></a><div class="linenumber">981</div><div style="width:12em;display:inline-block"></div>}
<a name="line982"></a><div class="linenumber">982</div><div style="width:10em;display:inline-block"></div>}
<a name="line983"></a><div class="linenumber">983</div><div style="width:10em;display:inline-block"></div>break;
<a name="line984"></a><div class="linenumber">984</div><div style="width:0em;display:inline-block"></div>
<a name="line985"></a><div class="linenumber">985</div><div style="width:8em;display:inline-block"></div>case&nbsp;"setUserCfg"&nbsp;:
<a name="line986"></a><div class="linenumber">986</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData))&nbsp;{
<a name="line987"></a><div class="linenumber">987</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_DATA");
<a name="line988"></a><div class="linenumber">988</div><div style="width:12em;display:inline-block"></div>return;
<a name="line989"></a><div class="linenumber">989</div><div style="width:10em;display:inline-block"></div>}
<a name="line990"></a><div class="linenumber">990</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isObject(msg.msgData.setUserCfg)&nbsp;||&nbsp;_.isEmpty(msg.msgData.setUserCfg))&nbsp;{
<a name="line991"></a><div class="linenumber">991</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line992"></a><div class="linenumber">992</div><div style="width:12em;display:inline-block"></div>return;
<a name="line993"></a><div class="linenumber">993</div><div style="width:10em;display:inline-block"></div>}
<a name="line994"></a><div class="linenumber">994</div><div style="width:0em;display:inline-block"></div>
<a name="line995"></a><div class="linenumber">995</div><div style="width:10em;display:inline-block"></div>//&nbsp;setUserCfg.p2pList
<a name="line996"></a><div class="linenumber">996</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData.setUserCfg.p2pList&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isObject(msg.msgData.setUserCfg.p2pList)&nbsp;||&nbsp;_.isEmpty(msg.msgData.setUserCfg.p2pList)))&nbsp;{
<a name="line997"></a><div class="linenumber">997</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line998"></a><div class="linenumber">998</div><div style="width:12em;display:inline-block"></div>return;
<a name="line999"></a><div class="linenumber">999</div><div style="width:10em;display:inline-block"></div>}
<a name="line1000"></a><div class="linenumber">1000</div><div style="width:10em;display:inline-block"></div>//&nbsp;TODO:&nbsp;Go&nbsp;through&nbsp;p2pList&nbsp;to&nbsp;confirm&nbsp;each&nbsp;key&nbsp;is&nbsp;an&nbsp;easyrtcid
<a name="line1001"></a><div class="linenumber">1001</div><div style="width:0em;display:inline-block"></div>
<a name="line1002"></a><div class="linenumber">1002</div><div style="width:10em;display:inline-block"></div>//&nbsp;setUserCfg.userSettings
<a name="line1003"></a><div class="linenumber">1003</div><div style="width:10em;display:inline-block"></div>if&nbsp;(msg.msgData.setUserCfg.userSettings&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isObject(msg.msgData.setUserCfg.userSettings)&nbsp;||&nbsp;_.isEmpty(msg.msgData.setUserCfg.userSettings)))&nbsp;{
<a name="line1004"></a><div class="linenumber">1004</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_STRUCTURE");
<a name="line1005"></a><div class="linenumber">1005</div><div style="width:12em;display:inline-block"></div>return;
<a name="line1006"></a><div class="linenumber">1006</div><div style="width:10em;display:inline-block"></div>}
<a name="line1007"></a><div class="linenumber">1007</div><div style="width:0em;display:inline-block"></div>
<a name="line1008"></a><div class="linenumber">1008</div><div style="width:10em;display:inline-block"></div>break;
<a name="line1009"></a><div class="linenumber">1009</div><div style="width:0em;display:inline-block"></div>
<a name="line1010"></a><div class="linenumber">1010</div><div style="width:8em;display:inline-block"></div>default:
<a name="line1011"></a><div class="linenumber">1011</div><div style="width:10em;display:inline-block"></div>//&nbsp;Reject&nbsp;all&nbsp;unknown&nbsp;msgType's
<a name="line1012"></a><div class="linenumber">1012</div><div style="width:10em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_TYPE");
<a name="line1013"></a><div class="linenumber">1013</div><div style="width:10em;display:inline-block"></div>return;
<a name="line1014"></a><div class="linenumber">1014</div><div style="width:6em;display:inline-block"></div>}
<a name="line1015"></a><div class="linenumber">1015</div><div style="width:0em;display:inline-block"></div>
<a name="line1016"></a><div class="linenumber">1016</div><div style="width:6em;display:inline-block"></div>break;
<a name="line1017"></a><div class="linenumber">1017</div><div style="width:0em;display:inline-block"></div>
<a name="line1018"></a><div class="linenumber">1018</div><div style="width:4em;display:inline-block"></div>case&nbsp;"easyrtcMsg":
<a name="line1019"></a><div class="linenumber">1019</div><div style="width:6em;display:inline-block"></div>//&nbsp;targetEasyrtcid
<a name="line1020"></a><div class="linenumber">1020</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.targetEasyrtcid&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isString(msg.targetEasyrtcid)&nbsp;||&nbsp;!getOption("easyrtcidRegExp").test(msg.targetEasyrtcid)))&nbsp;{
<a name="line1021"></a><div class="linenumber">1021</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_TARGET_EASYRTCID");
<a name="line1022"></a><div class="linenumber">1022</div><div style="width:8em;display:inline-block"></div>return;
<a name="line1023"></a><div class="linenumber">1023</div><div style="width:6em;display:inline-block"></div>}
<a name="line1024"></a><div class="linenumber">1024</div><div style="width:6em;display:inline-block"></div>//&nbsp;targetGroup
<a name="line1025"></a><div class="linenumber">1025</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.targetGroup&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isString(msg.targetGroup)&nbsp;||&nbsp;!getOption("groupNameRegExp").test(msg.targetGroup)))&nbsp;{
<a name="line1026"></a><div class="linenumber">1026</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_TARGET_GROUP");
<a name="line1027"></a><div class="linenumber">1027</div><div style="width:8em;display:inline-block"></div>return;
<a name="line1028"></a><div class="linenumber">1028</div><div style="width:6em;display:inline-block"></div>}
<a name="line1029"></a><div class="linenumber">1029</div><div style="width:6em;display:inline-block"></div>//&nbsp;targetRoom
<a name="line1030"></a><div class="linenumber">1030</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.targetRoom&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;(!_.isString(msg.targetRoom)&nbsp;||&nbsp;!getOption("roomNameRegExp").test(msg.targetRoom)))&nbsp;{
<a name="line1031"></a><div class="linenumber">1031</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_TARGET_ROOM");
<a name="line1032"></a><div class="linenumber">1032</div><div style="width:8em;display:inline-block"></div>return;
<a name="line1033"></a><div class="linenumber">1033</div><div style="width:6em;display:inline-block"></div>}
<a name="line1034"></a><div class="linenumber">1034</div><div style="width:6em;display:inline-block"></div>break;
<a name="line1035"></a><div class="linenumber">1035</div><div style="width:0em;display:inline-block"></div>
<a name="line1036"></a><div class="linenumber">1036</div><div style="width:4em;display:inline-block"></div>default:
<a name="line1037"></a><div class="linenumber">1037</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;false,&nbsp;"MSG_REJECT_BAD_TYPE");
<a name="line1038"></a><div class="linenumber">1038</div><div style="width:6em;display:inline-block"></div>return;
<a name="line1039"></a><div class="linenumber">1039</div><div style="width:2em;display:inline-block"></div>}
<a name="line1040"></a><div class="linenumber">1040</div><div style="width:0em;display:inline-block"></div>
<a name="line1041"></a><div class="linenumber">1041</div><div style="width:2em;display:inline-block"></div>//&nbsp;Incoming&nbsp;message&nbsp;syntactically&nbsp;valid
<a name="line1042"></a><div class="linenumber">1042</div><div style="width:2em;display:inline-block"></div>callback(null,&nbsp;true,&nbsp;null);
<a name="line1043"></a><div class="linenumber">1043</div><div style="width:0em;display:inline-block"></div>};
<a name="line1044"></a><div class="linenumber">1044</div><div style="width:0em;display:inline-block"></div>
<a name="line1045"></a><div class="linenumber">1045</div><div style="width:0em;display:inline-block"></div>
<a name="line1046"></a><div class="linenumber">1046</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1047"></a><div class="linenumber">1047</div><div style="width:0em;display:inline-block"></div>*&nbsp;Will&nbsp;attempt&nbsp;to&nbsp;deliver&nbsp;an&nbsp;EasyRTC&nbsp;session&nbsp;id&nbsp;via&nbsp;a&nbsp;cookie.&nbsp;Requires&nbsp;that&nbsp;session&nbsp;management&nbsp;be&nbsp;enabled&nbsp;from&nbsp;within&nbsp;Express.
<a name="line1048"></a><div class="linenumber">1048</div><div style="width:0em;display:inline-block"></div>*
<a name="line1049"></a><div class="linenumber">1049</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;req&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Http&nbsp;request&nbsp;object
<a name="line1050"></a><div class="linenumber">1050</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;res&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Http&nbsp;result&nbsp;object
<a name="line1051"></a><div class="linenumber">1051</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1052"></a><div class="linenumber">1052</div><div style="width:0em;display:inline-block"></div>pub.util.sendSessionCookie&nbsp;=&nbsp;function(req,&nbsp;res)&nbsp;{
<a name="line1053"></a><div class="linenumber">1053</div><div style="width:2em;display:inline-block"></div>//&nbsp;If&nbsp;sessions&nbsp;or&nbsp;session&nbsp;cookies&nbsp;are&nbsp;disabled,&nbsp;return&nbsp;without&nbsp;an&nbsp;error.
<a name="line1054"></a><div class="linenumber">1054</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!pub.getOption("sessionEnable")&nbsp;||&nbsp;!pub.getOption("sessionCookieEnable"))&nbsp;{
<a name="line1055"></a><div class="linenumber">1055</div><div style="width:4em;display:inline-block"></div>return;
<a name="line1056"></a><div class="linenumber">1056</div><div style="width:2em;display:inline-block"></div>}
<a name="line1057"></a><div class="linenumber">1057</div><div style="width:2em;display:inline-block"></div>if&nbsp;(req.sessionID&nbsp;&amp;&amp;&nbsp;(!req.cookies&nbsp;||&nbsp;!req.cookies["easyrtcsid"]&nbsp;||&nbsp;req.cookies["easyrtcsid"]&nbsp;!=&nbsp;req.sessionID))&nbsp;{
<a name="line1058"></a><div class="linenumber">1058</div><div style="width:4em;display:inline-block"></div>try&nbsp;{
<a name="line1059"></a><div class="linenumber">1059</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("Sending&nbsp;easyrtcsid&nbsp;cookie&nbsp;["&nbsp;+&nbsp;req.sessionID&nbsp;+&nbsp;"]&nbsp;to&nbsp;["&nbsp;+&nbsp;req.ip&nbsp;+&nbsp;"]&nbsp;for&nbsp;request&nbsp;["&nbsp;+&nbsp;req.url&nbsp;+&nbsp;"]");
<a name="line1060"></a><div class="linenumber">1060</div><div style="width:6em;display:inline-block"></div>res.cookie("easyrtcsid",&nbsp;req.sessionID,&nbsp;{maxAge:&nbsp;2592000000,&nbsp;httpOnly:&nbsp;false});
<a name="line1061"></a><div class="linenumber">1061</div><div style="width:4em;display:inline-block"></div>}&nbsp;catch&nbsp;(e)&nbsp;{
<a name="line1062"></a><div class="linenumber">1062</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Problem&nbsp;setting&nbsp;easyrtcsid&nbsp;cookie&nbsp;["&nbsp;+&nbsp;req.sessionID&nbsp;+&nbsp;"]&nbsp;to&nbsp;["&nbsp;+&nbsp;req.ip&nbsp;+&nbsp;"]&nbsp;for&nbsp;request&nbsp;["&nbsp;+&nbsp;req.url&nbsp;+&nbsp;"]");
<a name="line1063"></a><div class="linenumber">1063</div><div style="width:4em;display:inline-block"></div>}
<a name="line1064"></a><div class="linenumber">1064</div><div style="width:2em;display:inline-block"></div>}
<a name="line1065"></a><div class="linenumber">1065</div><div style="width:0em;display:inline-block"></div>};
<a name="line1066"></a><div class="linenumber">1066</div><div style="width:0em;display:inline-block"></div>
<a name="line1067"></a><div class="linenumber">1067</div><div style="width:0em;display:inline-block"></div>
<a name="line1068"></a><div class="linenumber">1068</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1069"></a><div class="linenumber">1069</div><div style="width:0em;display:inline-block"></div>*&nbsp;Determine&nbsp;if&nbsp;a&nbsp;given&nbsp;application&nbsp;name&nbsp;has&nbsp;been&nbsp;defined.
<a name="line1070"></a><div class="linenumber">1070</div><div style="width:0em;display:inline-block"></div>*
<a name="line1071"></a><div class="linenumber">1071</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;appName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Application&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;it&nbsp;on&nbsp;the&nbsp;server.
<a name="line1072"></a><div class="linenumber">1072</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;boolean)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;boolean&nbsp;of&nbsp;whether&nbsp;application&nbsp;is&nbsp;defined.
<a name="line1073"></a><div class="linenumber">1073</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1074"></a><div class="linenumber">1074</div><div style="width:0em;display:inline-block"></div>pub.isApp&nbsp;=&nbsp;function(appName,&nbsp;callback)&nbsp;{
<a name="line1075"></a><div class="linenumber">1075</div><div style="width:2em;display:inline-block"></div>callback(null,&nbsp;(e.app[appName]&nbsp;?&nbsp;true&nbsp;:&nbsp;false));
<a name="line1076"></a><div class="linenumber">1076</div><div style="width:0em;display:inline-block"></div>};
<a name="line1077"></a><div class="linenumber">1077</div><div style="width:0em;display:inline-block"></div>
<a name="line1078"></a><div class="linenumber">1078</div><div style="width:0em;display:inline-block"></div>
<a name="line1079"></a><div class="linenumber">1079</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1080"></a><div class="linenumber">1080</div><div style="width:0em;display:inline-block"></div>*&nbsp;Creates&nbsp;a&nbsp;new&nbsp;EasyRTC&nbsp;application&nbsp;with&nbsp;default&nbsp;values.&nbsp;If&nbsp;a&nbsp;callback&nbsp;is&nbsp;provided,&nbsp;it&nbsp;will&nbsp;receive&nbsp;the&nbsp;new&nbsp;application&nbsp;object.
<a name="line1081"></a><div class="linenumber">1081</div><div style="width:0em;display:inline-block"></div>*
<a name="line1082"></a><div class="linenumber">1082</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;callback&nbsp;may&nbsp;receive&nbsp;an&nbsp;Error&nbsp;object&nbsp;if&nbsp;unsuccessful.&nbsp;Depending&nbsp;on&nbsp;the&nbsp;severity,&nbsp;known&nbsp;errors&nbsp;have&nbsp;an&nbsp;"instanceof"&nbsp;ApplicationWarning&nbsp;or&nbsp;ApplicationError.
<a name="line1083"></a><div class="linenumber">1083</div><div style="width:0em;display:inline-block"></div>*
<a name="line1084"></a><div class="linenumber">1084</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;appName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Application&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;it&nbsp;on&nbsp;the&nbsp;server.
<a name="line1085"></a><div class="linenumber">1085</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?object}&nbsp;options&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Options&nbsp;object&nbsp;with&nbsp;options&nbsp;to&nbsp;apply&nbsp;to&nbsp;the&nbsp;application.&nbsp;May&nbsp;be&nbsp;null.
<a name="line1086"></a><div class="linenumber">1086</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{appCallback}&nbsp;[callback]&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;application&nbsp;object
<a name="line1087"></a><div class="linenumber">1087</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1088"></a><div class="linenumber">1088</div><div style="width:0em;display:inline-block"></div>pub.createApp&nbsp;=&nbsp;function(appName,&nbsp;options,&nbsp;callback)&nbsp;{
<a name="line1089"></a><div class="linenumber">1089</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isFunction(callback))&nbsp;{
<a name="line1090"></a><div class="linenumber">1090</div><div style="width:4em;display:inline-block"></div>callback&nbsp;=&nbsp;function(err,&nbsp;appObj)&nbsp;{
<a name="line1091"></a><div class="linenumber">1091</div><div style="width:4em;display:inline-block"></div>};
<a name="line1092"></a><div class="linenumber">1092</div><div style="width:2em;display:inline-block"></div>}
<a name="line1093"></a><div class="linenumber">1093</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!appName&nbsp;||&nbsp;!pub.getOption("appNameRegExp").test(appName))&nbsp;{
<a name="line1094"></a><div class="linenumber">1094</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;application&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;appName&nbsp;+&nbsp;"'");
<a name="line1095"></a><div class="linenumber">1095</div><div style="width:4em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;create&nbsp;application&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;appName&nbsp;+&nbsp;"'"));
<a name="line1096"></a><div class="linenumber">1096</div><div style="width:4em;display:inline-block"></div>return;
<a name="line1097"></a><div class="linenumber">1097</div><div style="width:2em;display:inline-block"></div>}
<a name="line1098"></a><div class="linenumber">1098</div><div style="width:2em;display:inline-block"></div>if&nbsp;(e.app[appName])&nbsp;{
<a name="line1099"></a><div class="linenumber">1099</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;application&nbsp;which&nbsp;already&nbsp;exists:&nbsp;'"&nbsp;+&nbsp;appName&nbsp;+&nbsp;"'");
<a name="line1100"></a><div class="linenumber">1100</div><div style="width:4em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;create&nbsp;application&nbsp;which&nbsp;already&nbsp;exists:&nbsp;'"&nbsp;+&nbsp;appName&nbsp;+&nbsp;"'"));
<a name="line1101"></a><div class="linenumber">1101</div><div style="width:4em;display:inline-block"></div>return;
<a name="line1102"></a><div class="linenumber">1102</div><div style="width:2em;display:inline-block"></div>}
<a name="line1103"></a><div class="linenumber">1103</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isObject(options))&nbsp;{
<a name="line1104"></a><div class="linenumber">1104</div><div style="width:4em;display:inline-block"></div>options&nbsp;=&nbsp;{};
<a name="line1105"></a><div class="linenumber">1105</div><div style="width:2em;display:inline-block"></div>}
<a name="line1106"></a><div class="linenumber">1106</div><div style="width:0em;display:inline-block"></div>
<a name="line1107"></a><div class="linenumber">1107</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("Creating&nbsp;application:&nbsp;'"&nbsp;+&nbsp;appName&nbsp;+&nbsp;"'");
<a name="line1108"></a><div class="linenumber">1108</div><div style="width:0em;display:inline-block"></div>
<a name="line1109"></a><div class="linenumber">1109</div><div style="width:2em;display:inline-block"></div>e.app[appName]&nbsp;=&nbsp;{
<a name="line1110"></a><div class="linenumber">1110</div><div style="width:4em;display:inline-block"></div>appName:&nbsp;appName,
<a name="line1111"></a><div class="linenumber">1111</div><div style="width:4em;display:inline-block"></div>connection:&nbsp;{},
<a name="line1112"></a><div class="linenumber">1112</div><div style="width:4em;display:inline-block"></div>field:&nbsp;{},
<a name="line1113"></a><div class="linenumber">1113</div><div style="width:4em;display:inline-block"></div>group:&nbsp;{},
<a name="line1114"></a><div class="linenumber">1114</div><div style="width:4em;display:inline-block"></div>option:&nbsp;{},
<a name="line1115"></a><div class="linenumber">1115</div><div style="width:4em;display:inline-block"></div>room:&nbsp;{},
<a name="line1116"></a><div class="linenumber">1116</div><div style="width:4em;display:inline-block"></div>session:&nbsp;{}
<a name="line1117"></a><div class="linenumber">1117</div><div style="width:2em;display:inline-block"></div>};
<a name="line1118"></a><div class="linenumber">1118</div><div style="width:0em;display:inline-block"></div>
<a name="line1119"></a><div class="linenumber">1119</div><div style="width:2em;display:inline-block"></div>//&nbsp;Get&nbsp;the&nbsp;new&nbsp;app&nbsp;object
<a name="line1120"></a><div class="linenumber">1120</div><div style="width:2em;display:inline-block"></div>pub.app(appName,&nbsp;function(err,&nbsp;appObj)&nbsp;{
<a name="line1121"></a><div class="linenumber">1121</div><div style="width:4em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1122"></a><div class="linenumber">1122</div><div style="width:6em;display:inline-block"></div>callback(err);
<a name="line1123"></a><div class="linenumber">1123</div><div style="width:6em;display:inline-block"></div>return;
<a name="line1124"></a><div class="linenumber">1124</div><div style="width:4em;display:inline-block"></div>}
<a name="line1125"></a><div class="linenumber">1125</div><div style="width:0em;display:inline-block"></div>
<a name="line1126"></a><div class="linenumber">1126</div><div style="width:4em;display:inline-block"></div>//&nbsp;Set&nbsp;all&nbsp;options&nbsp;in&nbsp;options&nbsp;object.&nbsp;If&nbsp;any&nbsp;fail,&nbsp;an&nbsp;error&nbsp;will&nbsp;be&nbsp;sent&nbsp;to&nbsp;the&nbsp;callback.
<a name="line1127"></a><div class="linenumber">1127</div><div style="width:4em;display:inline-block"></div>async.each(Object.keys(options),&nbsp;function(currentOptionName,&nbsp;asyncCallback)&nbsp;{
<a name="line1128"></a><div class="linenumber">1128</div><div style="width:6em;display:inline-block"></div>appObj.setOption(currentOptionName,&nbsp;options[currentOptionName]);
<a name="line1129"></a><div class="linenumber">1129</div><div style="width:6em;display:inline-block"></div>asyncCallback(null);
<a name="line1130"></a><div class="linenumber">1130</div><div style="width:4em;display:inline-block"></div>},
<a name="line1131"></a><div class="linenumber">1131</div><div style="width:8em;display:inline-block"></div>function(err)&nbsp;{
<a name="line1132"></a><div class="linenumber">1132</div><div style="width:10em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1133"></a><div class="linenumber">1133</div><div style="width:12em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationError("Could&nbsp;not&nbsp;set&nbsp;options&nbsp;when&nbsp;creating&nbsp;application:&nbsp;'"&nbsp;+&nbsp;appName&nbsp;+&nbsp;"'",&nbsp;err));
<a name="line1134"></a><div class="linenumber">1134</div><div style="width:12em;display:inline-block"></div>return;
<a name="line1135"></a><div class="linenumber">1135</div><div style="width:10em;display:inline-block"></div>}
<a name="line1136"></a><div class="linenumber">1136</div><div style="width:10em;display:inline-block"></div>//&nbsp;Set&nbsp;default&nbsp;application&nbsp;fields
<a name="line1137"></a><div class="linenumber">1137</div><div style="width:10em;display:inline-block"></div>var&nbsp;appDefaultFieldObj&nbsp;=&nbsp;appObj.getOption("appDefaultFieldObj");
<a name="line1138"></a><div class="linenumber">1138</div><div style="width:10em;display:inline-block"></div>if&nbsp;(_.isObject(appDefaultFieldObj))&nbsp;{
<a name="line1139"></a><div class="linenumber">1139</div><div style="width:12em;display:inline-block"></div>for&nbsp;(var&nbsp;currentFieldName&nbsp;in&nbsp;appDefaultFieldObj)&nbsp;{
<a name="line1140"></a><div class="linenumber">1140</div><div style="width:14em;display:inline-block"></div>appObj.setField(
<a name="line1141"></a><div class="linenumber">1141</div><div style="width:18em;display:inline-block"></div>currentFieldName,
<a name="line1142"></a><div class="linenumber">1142</div><div style="width:18em;display:inline-block"></div>appDefaultFieldObj[currentFieldName].fieldValue,
<a name="line1143"></a><div class="linenumber">1143</div><div style="width:18em;display:inline-block"></div>appDefaultFieldObj[currentFieldName].fieldOption,
<a name="line1144"></a><div class="linenumber">1144</div><div style="width:18em;display:inline-block"></div>null
<a name="line1145"></a><div class="linenumber">1145</div><div style="width:18em;display:inline-block"></div>);
<a name="line1146"></a><div class="linenumber">1146</div><div style="width:12em;display:inline-block"></div>}
<a name="line1147"></a><div class="linenumber">1147</div><div style="width:10em;display:inline-block"></div>}
<a name="line1148"></a><div class="linenumber">1148</div><div style="width:0em;display:inline-block"></div>
<a name="line1149"></a><div class="linenumber">1149</div><div style="width:10em;display:inline-block"></div>if&nbsp;(appObj.getOption("roomDefaultEnable"))&nbsp;{
<a name="line1150"></a><div class="linenumber">1150</div><div style="width:12em;display:inline-block"></div>pub.events.emit("roomCreate",&nbsp;appObj,&nbsp;null,&nbsp;appObj.getOption("roomDefaultName"),&nbsp;null,&nbsp;function(err,&nbsp;roomObj){
<a name="line1151"></a><div class="linenumber">1151</div><div style="width:14em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1152"></a><div class="linenumber">1152</div><div style="width:16em;display:inline-block"></div>callback(err);
<a name="line1153"></a><div class="linenumber">1153</div><div style="width:16em;display:inline-block"></div>return;
<a name="line1154"></a><div class="linenumber">1154</div><div style="width:14em;display:inline-block"></div>}
<a name="line1155"></a><div class="linenumber">1155</div><div style="width:14em;display:inline-block"></div>//&nbsp;Return&nbsp;app&nbsp;object&nbsp;to&nbsp;callback
<a name="line1156"></a><div class="linenumber">1156</div><div style="width:14em;display:inline-block"></div>callback(null,&nbsp;appObj);
<a name="line1157"></a><div class="linenumber">1157</div><div style="width:12em;display:inline-block"></div>});
<a name="line1158"></a><div class="linenumber">1158</div><div style="width:10em;display:inline-block"></div>}
<a name="line1159"></a><div class="linenumber">1159</div><div style="width:10em;display:inline-block"></div>else&nbsp;{
<a name="line1160"></a><div class="linenumber">1160</div><div style="width:12em;display:inline-block"></div>//&nbsp;Return&nbsp;app&nbsp;object&nbsp;to&nbsp;callback
<a name="line1161"></a><div class="linenumber">1161</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;appObj);
<a name="line1162"></a><div class="linenumber">1162</div><div style="width:10em;display:inline-block"></div>}
<a name="line1163"></a><div class="linenumber">1163</div><div style="width:8em;display:inline-block"></div>});
<a name="line1164"></a><div class="linenumber">1164</div><div style="width:2em;display:inline-block"></div>});
<a name="line1165"></a><div class="linenumber">1165</div><div style="width:0em;display:inline-block"></div>};
<a name="line1166"></a><div class="linenumber">1166</div><div style="width:0em;display:inline-block"></div>
<a name="line1167"></a><div class="linenumber">1167</div><div style="width:0em;display:inline-block"></div>
<a name="line1168"></a><div class="linenumber">1168</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1169"></a><div class="linenumber">1169</div><div style="width:0em;display:inline-block"></div>*&nbsp;Contains&nbsp;the&nbsp;methods&nbsp;for&nbsp;interfacing&nbsp;with&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line1170"></a><div class="linenumber">1170</div><div style="width:0em;display:inline-block"></div>*
<a name="line1171"></a><div class="linenumber">1171</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;callback&nbsp;will&nbsp;receive&nbsp;an&nbsp;application&nbsp;object&nbsp;upon&nbsp;successful&nbsp;retrieval&nbsp;of&nbsp;application.
<a name="line1172"></a><div class="linenumber">1172</div><div style="width:0em;display:inline-block"></div>*
<a name="line1173"></a><div class="linenumber">1173</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;callback&nbsp;may&nbsp;receive&nbsp;an&nbsp;Error&nbsp;object&nbsp;if&nbsp;unsuccessful.&nbsp;Depending&nbsp;on&nbsp;the&nbsp;severity,&nbsp;known&nbsp;errors&nbsp;have&nbsp;an&nbsp;"instanceof"&nbsp;ApplicationWarning&nbsp;or&nbsp;ApplicationError.
<a name="line1174"></a><div class="linenumber">1174</div><div style="width:0em;display:inline-block"></div>*
<a name="line1175"></a><div class="linenumber">1175</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;function&nbsp;does&nbsp;return&nbsp;an&nbsp;application&nbsp;object&nbsp;which&nbsp;is&nbsp;useful&nbsp;for&nbsp;chaining,&nbsp;however&nbsp;the&nbsp;callback&nbsp;approach&nbsp;is&nbsp;safer&nbsp;and&nbsp;provides&nbsp;additional&nbsp;information&nbsp;in&nbsp;the&nbsp;event&nbsp;of&nbsp;an&nbsp;error.
<a name="line1176"></a><div class="linenumber">1176</div><div style="width:0em;display:inline-block"></div>*
<a name="line1177"></a><div class="linenumber">1177</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?string}&nbsp;appName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Application&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;it&nbsp;on&nbsp;the&nbsp;server.&nbsp;Uses&nbsp;default&nbsp;application&nbsp;if&nbsp;null.
<a name="line1178"></a><div class="linenumber">1178</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{appCallback}&nbsp;[callback]&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;application&nbsp;object
<a name="line1179"></a><div class="linenumber">1179</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1180"></a><div class="linenumber">1180</div><div style="width:0em;display:inline-block"></div>pub.app&nbsp;=&nbsp;function(appName,&nbsp;callback)&nbsp;{
<a name="line1181"></a><div class="linenumber">1181</div><div style="width:0em;display:inline-block"></div>
<a name="line1182"></a><div class="linenumber">1182</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1183"></a><div class="linenumber">1183</div><div style="width:2em;display:inline-block"></div>*&nbsp;The&nbsp;primary&nbsp;method&nbsp;for&nbsp;interfacing&nbsp;with&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line1184"></a><div class="linenumber">1184</div><div style="width:2em;display:inline-block"></div>*
<a name="line1185"></a><div class="linenumber">1185</div><div style="width:2em;display:inline-block"></div>*&nbsp;@class&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;appObj
<a name="line1186"></a><div class="linenumber">1186</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub
<a name="line1187"></a><div class="linenumber">1187</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1188"></a><div class="linenumber">1188</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;{};
<a name="line1189"></a><div class="linenumber">1189</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!appName)&nbsp;{
<a name="line1190"></a><div class="linenumber">1190</div><div style="width:4em;display:inline-block"></div>appName&nbsp;=&nbsp;pub.getOption("appDefaultName");
<a name="line1191"></a><div class="linenumber">1191</div><div style="width:2em;display:inline-block"></div>}
<a name="line1192"></a><div class="linenumber">1192</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isFunction(callback))&nbsp;{
<a name="line1193"></a><div class="linenumber">1193</div><div style="width:4em;display:inline-block"></div>callback&nbsp;=&nbsp;function(err,&nbsp;appObj)&nbsp;{
<a name="line1194"></a><div class="linenumber">1194</div><div style="width:4em;display:inline-block"></div>};
<a name="line1195"></a><div class="linenumber">1195</div><div style="width:2em;display:inline-block"></div>}
<a name="line1196"></a><div class="linenumber">1196</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!e.app[appName])&nbsp;{
<a name="line1197"></a><div class="linenumber">1197</div><div style="width:4em;display:inline-block"></div>pub.util.logDebug("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;application&nbsp;name:&nbsp;'"&nbsp;+&nbsp;appName&nbsp;+&nbsp;"'");
<a name="line1198"></a><div class="linenumber">1198</div><div style="width:4em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;application&nbsp;name:&nbsp;'"&nbsp;+&nbsp;appName&nbsp;+&nbsp;"'"));
<a name="line1199"></a><div class="linenumber">1199</div><div style="width:4em;display:inline-block"></div>return;
<a name="line1200"></a><div class="linenumber">1200</div><div style="width:2em;display:inline-block"></div>}
<a name="line1201"></a><div class="linenumber">1201</div><div style="width:0em;display:inline-block"></div>
<a name="line1202"></a><div class="linenumber">1202</div><div style="width:0em;display:inline-block"></div>
<a name="line1203"></a><div class="linenumber">1203</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1204"></a><div class="linenumber">1204</div><div style="width:2em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;event&nbsp;functions
<a name="line1205"></a><div class="linenumber">1205</div><div style="width:2em;display:inline-block"></div>*&nbsp;
<a name="line1206"></a><div class="linenumber">1206</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1207"></a><div class="linenumber">1207</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1208"></a><div class="linenumber">1208</div><div style="width:2em;display:inline-block"></div>appObj.events&nbsp;=&nbsp;pub.events;
<a name="line1209"></a><div class="linenumber">1209</div><div style="width:0em;display:inline-block"></div>
<a name="line1210"></a><div class="linenumber">1210</div><div style="width:0em;display:inline-block"></div>
<a name="line1211"></a><div class="linenumber">1211</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1212"></a><div class="linenumber">1212</div><div style="width:2em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;utility&nbsp;functions
<a name="line1213"></a><div class="linenumber">1213</div><div style="width:2em;display:inline-block"></div>*&nbsp;
<a name="line1214"></a><div class="linenumber">1214</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1215"></a><div class="linenumber">1215</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1216"></a><div class="linenumber">1216</div><div style="width:2em;display:inline-block"></div>appObj.util&nbsp;=&nbsp;pub.util;
<a name="line1217"></a><div class="linenumber">1217</div><div style="width:0em;display:inline-block"></div>
<a name="line1218"></a><div class="linenumber">1218</div><div style="width:0em;display:inline-block"></div>
<a name="line1219"></a><div class="linenumber">1219</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1220"></a><div class="linenumber">1220</div><div style="width:2em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;application&nbsp;name&nbsp;for&nbsp;the&nbsp;application.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line1221"></a><div class="linenumber">1221</div><div style="width:2em;display:inline-block"></div>*
<a name="line1222"></a><div class="linenumber">1222</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1223"></a><div class="linenumber">1223</div><div style="width:2em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;application&nbsp;name.
<a name="line1224"></a><div class="linenumber">1224</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1225"></a><div class="linenumber">1225</div><div style="width:2em;display:inline-block"></div>appObj.getAppName&nbsp;=&nbsp;function()&nbsp;{
<a name="line1226"></a><div class="linenumber">1226</div><div style="width:4em;display:inline-block"></div>return&nbsp;appName;
<a name="line1227"></a><div class="linenumber">1227</div><div style="width:2em;display:inline-block"></div>};
<a name="line1228"></a><div class="linenumber">1228</div><div style="width:0em;display:inline-block"></div>
<a name="line1229"></a><div class="linenumber">1229</div><div style="width:0em;display:inline-block"></div>
<a name="line1230"></a><div class="linenumber">1230</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1231"></a><div class="linenumber">1231</div><div style="width:2em;display:inline-block"></div>*&nbsp;Sends&nbsp;the&nbsp;count&nbsp;of&nbsp;the&nbsp;number&nbsp;of&nbsp;connections&nbsp;in&nbsp;the&nbsp;app&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.
<a name="line1232"></a><div class="linenumber">1232</div><div style="width:2em;display:inline-block"></div>*
<a name="line1233"></a><div class="linenumber">1233</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1234"></a><div class="linenumber">1234</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Number)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;containing&nbsp;all&nbsp;easyrtcids.
<a name="line1235"></a><div class="linenumber">1235</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1236"></a><div class="linenumber">1236</div><div style="width:2em;display:inline-block"></div>appObj.getConnectionCount&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line1237"></a><div class="linenumber">1237</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;appObj.getConnectionCountSync());
<a name="line1238"></a><div class="linenumber">1238</div><div style="width:2em;display:inline-block"></div>};
<a name="line1239"></a><div class="linenumber">1239</div><div style="width:0em;display:inline-block"></div>
<a name="line1240"></a><div class="linenumber">1240</div><div style="width:0em;display:inline-block"></div>
<a name="line1241"></a><div class="linenumber">1241</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1242"></a><div class="linenumber">1242</div><div style="width:2em;display:inline-block"></div>*&nbsp;Sends&nbsp;the&nbsp;count&nbsp;of&nbsp;the&nbsp;number&nbsp;of&nbsp;connections&nbsp;in&nbsp;the&nbsp;app&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.
<a name="line1243"></a><div class="linenumber">1243</div><div style="width:2em;display:inline-block"></div>*
<a name="line1244"></a><div class="linenumber">1244</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1245"></a><div class="linenumber">1245</div><div style="width:2em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Number}&nbsp;The&nbsp;current&nbsp;number&nbsp;of&nbsp;connections&nbsp;in&nbsp;a&nbsp;room.
<a name="line1246"></a><div class="linenumber">1246</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1247"></a><div class="linenumber">1247</div><div style="width:2em;display:inline-block"></div>appObj.getConnectionCountSync&nbsp;=&nbsp;function()&nbsp;{
<a name="line1248"></a><div class="linenumber">1248</div><div style="width:4em;display:inline-block"></div>return&nbsp;_.size(e.app[appName].connection);
<a name="line1249"></a><div class="linenumber">1249</div><div style="width:2em;display:inline-block"></div>};
<a name="line1250"></a><div class="linenumber">1250</div><div style="width:0em;display:inline-block"></div>
<a name="line1251"></a><div class="linenumber">1251</div><div style="width:0em;display:inline-block"></div>
<a name="line1252"></a><div class="linenumber">1252</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1253"></a><div class="linenumber">1253</div><div style="width:2em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;array&nbsp;of&nbsp;all&nbsp;easyrtcids&nbsp;connected&nbsp;to&nbsp;the&nbsp;application
<a name="line1254"></a><div class="linenumber">1254</div><div style="width:2em;display:inline-block"></div>*
<a name="line1255"></a><div class="linenumber">1255</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1256"></a><div class="linenumber">1256</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Array.&lt;string&gt;)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;of&nbsp;easyrtcids.
<a name="line1257"></a><div class="linenumber">1257</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1258"></a><div class="linenumber">1258</div><div style="width:2em;display:inline-block"></div>appObj.getConnectionEasyrtcids&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line1259"></a><div class="linenumber">1259</div><div style="width:4em;display:inline-block"></div>var&nbsp;easyrtcids&nbsp;=&nbsp;[];
<a name="line1260"></a><div class="linenumber">1260</div><div style="width:4em;display:inline-block"></div>for&nbsp;(var&nbsp;key&nbsp;in&nbsp;e.app[appName].connection)&nbsp;{
<a name="line1261"></a><div class="linenumber">1261</div><div style="width:6em;display:inline-block"></div>easyrtcids.push(key);
<a name="line1262"></a><div class="linenumber">1262</div><div style="width:4em;display:inline-block"></div>}
<a name="line1263"></a><div class="linenumber">1263</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;easyrtcids);
<a name="line1264"></a><div class="linenumber">1264</div><div style="width:2em;display:inline-block"></div>};
<a name="line1265"></a><div class="linenumber">1265</div><div style="width:0em;display:inline-block"></div>
<a name="line1266"></a><div class="linenumber">1266</div><div style="width:0em;display:inline-block"></div>
<a name="line1267"></a><div class="linenumber">1267</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1268"></a><div class="linenumber">1268</div><div style="width:2em;display:inline-block"></div>*&nbsp;Returns&nbsp;application&nbsp;level&nbsp;field&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.
<a name="line1269"></a><div class="linenumber">1269</div><div style="width:2em;display:inline-block"></div>*
<a name="line1270"></a><div class="linenumber">1270</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1271"></a><div class="linenumber">1271</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line1272"></a><div class="linenumber">1272</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;field&nbsp;object&nbsp;(any&nbsp;type)
<a name="line1273"></a><div class="linenumber">1273</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1274"></a><div class="linenumber">1274</div><div style="width:2em;display:inline-block"></div>appObj.getField&nbsp;=&nbsp;function(fieldName,&nbsp;callback)&nbsp;{
<a name="line1275"></a><div class="linenumber">1275</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!e.app[appName].field[fieldName])&nbsp;{
<a name="line1276"></a><div class="linenumber">1276</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("Can&nbsp;not&nbsp;find&nbsp;app&nbsp;field:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'");
<a name="line1277"></a><div class="linenumber">1277</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;find&nbsp;app&nbsp;field:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'"));
<a name="line1278"></a><div class="linenumber">1278</div><div style="width:6em;display:inline-block"></div>return;
<a name="line1279"></a><div class="linenumber">1279</div><div style="width:4em;display:inline-block"></div>}
<a name="line1280"></a><div class="linenumber">1280</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;pub.util.deepCopy(e.app[appName].field[fieldName]));
<a name="line1281"></a><div class="linenumber">1281</div><div style="width:2em;display:inline-block"></div>};
<a name="line1282"></a><div class="linenumber">1282</div><div style="width:0em;display:inline-block"></div>
<a name="line1283"></a><div class="linenumber">1283</div><div style="width:0em;display:inline-block"></div>
<a name="line1284"></a><div class="linenumber">1284</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1285"></a><div class="linenumber">1285</div><div style="width:2em;display:inline-block"></div>*&nbsp;Returns&nbsp;application&nbsp;level&nbsp;field&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.&nbsp;If&nbsp;the&nbsp;field&nbsp;is&nbsp;not&nbsp;set,&nbsp;it&nbsp;will&nbsp;return&nbsp;a&nbsp;field&nbsp;object&nbsp;will&nbsp;a&nbsp;null&nbsp;field&nbsp;value.&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;synchronous&nbsp;function,&nbsp;thus&nbsp;may&nbsp;not&nbsp;be&nbsp;available&nbsp;in&nbsp;custom&nbsp;cases&nbsp;where&nbsp;state&nbsp;is&nbsp;not&nbsp;kept&nbsp;in&nbsp;memory.
<a name="line1286"></a><div class="linenumber">1286</div><div style="width:2em;display:inline-block"></div>*
<a name="line1287"></a><div class="linenumber">1287</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1288"></a><div class="linenumber">1288</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line1289"></a><div class="linenumber">1289</div><div style="width:2em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;object
<a name="line1290"></a><div class="linenumber">1290</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1291"></a><div class="linenumber">1291</div><div style="width:2em;display:inline-block"></div>appObj.getFieldSync&nbsp;=&nbsp;function(fieldName)&nbsp;{
<a name="line1292"></a><div class="linenumber">1292</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!e.app[appName].field[fieldName])&nbsp;{
<a name="line1293"></a><div class="linenumber">1293</div><div style="width:6em;display:inline-block"></div>return&nbsp;{"fieldName":&nbsp;fieldName,&nbsp;"fieldOption":&nbsp;{},&nbsp;"fieldValue":&nbsp;null};
<a name="line1294"></a><div class="linenumber">1294</div><div style="width:4em;display:inline-block"></div>}
<a name="line1295"></a><div class="linenumber">1295</div><div style="width:4em;display:inline-block"></div>return&nbsp;pub.util.deepCopy(e.app[appName].field[fieldName]);
<a name="line1296"></a><div class="linenumber">1296</div><div style="width:2em;display:inline-block"></div>};
<a name="line1297"></a><div class="linenumber">1297</div><div style="width:0em;display:inline-block"></div>
<a name="line1298"></a><div class="linenumber">1298</div><div style="width:0em;display:inline-block"></div>
<a name="line1299"></a><div class="linenumber">1299</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1300"></a><div class="linenumber">1300</div><div style="width:2em;display:inline-block"></div>*&nbsp;Returns&nbsp;application&nbsp;level&nbsp;field&nbsp;value&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.&nbsp;If&nbsp;the&nbsp;field&nbsp;is&nbsp;not&nbsp;set,&nbsp;it&nbsp;will&nbsp;return&nbsp;a&nbsp;null&nbsp;field&nbsp;value.&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;synchronous&nbsp;function,&nbsp;thus&nbsp;may&nbsp;not&nbsp;be&nbsp;available&nbsp;in&nbsp;custom&nbsp;cases&nbsp;where&nbsp;state&nbsp;is&nbsp;not&nbsp;kept&nbsp;in&nbsp;memory.
<a name="line1301"></a><div class="linenumber">1301</div><div style="width:2em;display:inline-block"></div>*
<a name="line1302"></a><div class="linenumber">1302</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1303"></a><div class="linenumber">1303</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line1304"></a><div class="linenumber">1304</div><div style="width:2em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;value.&nbsp;Can&nbsp;be&nbsp;any&nbsp;JSON&nbsp;object.
<a name="line1305"></a><div class="linenumber">1305</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1306"></a><div class="linenumber">1306</div><div style="width:2em;display:inline-block"></div>appObj.getFieldValueSync&nbsp;=&nbsp;function(fieldName)&nbsp;{
<a name="line1307"></a><div class="linenumber">1307</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!e.app[appName].field[fieldName])&nbsp;{
<a name="line1308"></a><div class="linenumber">1308</div><div style="width:6em;display:inline-block"></div>return&nbsp;null;
<a name="line1309"></a><div class="linenumber">1309</div><div style="width:4em;display:inline-block"></div>}
<a name="line1310"></a><div class="linenumber">1310</div><div style="width:4em;display:inline-block"></div>return&nbsp;pub.util.deepCopy(e.app[appName].field[fieldName].fieldValue);
<a name="line1311"></a><div class="linenumber">1311</div><div style="width:2em;display:inline-block"></div>};
<a name="line1312"></a><div class="linenumber">1312</div><div style="width:0em;display:inline-block"></div>
<a name="line1313"></a><div class="linenumber">1313</div><div style="width:0em;display:inline-block"></div>
<a name="line1314"></a><div class="linenumber">1314</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1315"></a><div class="linenumber">1315</div><div style="width:2em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;object&nbsp;containing&nbsp;all&nbsp;field&nbsp;names&nbsp;and&nbsp;values&nbsp;within&nbsp;the&nbsp;application.&nbsp;Can&nbsp;be&nbsp;limited&nbsp;to&nbsp;fields&nbsp;with&nbsp;isShared&nbsp;option&nbsp;set&nbsp;to&nbsp;true.
<a name="line1316"></a><div class="linenumber">1316</div><div style="width:2em;display:inline-block"></div>*
<a name="line1317"></a><div class="linenumber">1317</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1318"></a><div class="linenumber">1318</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{boolean}&nbsp;&nbsp;&nbsp;limitToIsShared&nbsp;Limits&nbsp;returned&nbsp;fields&nbsp;to&nbsp;those&nbsp;which&nbsp;have&nbsp;the&nbsp;isShared&nbsp;option&nbsp;set&nbsp;to&nbsp;true.
<a name="line1319"></a><div class="linenumber">1319</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;field&nbsp;names&nbsp;and&nbsp;values.
<a name="line1320"></a><div class="linenumber">1320</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1321"></a><div class="linenumber">1321</div><div style="width:2em;display:inline-block"></div>appObj.getFields&nbsp;=&nbsp;function(limitToIsShared,&nbsp;callback)&nbsp;{
<a name="line1322"></a><div class="linenumber">1322</div><div style="width:4em;display:inline-block"></div>var&nbsp;fieldObj&nbsp;=&nbsp;{};
<a name="line1323"></a><div class="linenumber">1323</div><div style="width:4em;display:inline-block"></div>for&nbsp;(var&nbsp;fieldName&nbsp;in&nbsp;e.app[appName].field)&nbsp;{
<a name="line1324"></a><div class="linenumber">1324</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!limitToIsShared&nbsp;||&nbsp;e.app[appName].field[fieldName].fieldOption.isShared)&nbsp;{
<a name="line1325"></a><div class="linenumber">1325</div><div style="width:8em;display:inline-block"></div>fieldObj[fieldName]&nbsp;=&nbsp;{
<a name="line1326"></a><div class="linenumber">1326</div><div style="width:10em;display:inline-block"></div>fieldName:&nbsp;fieldName,
<a name="line1327"></a><div class="linenumber">1327</div><div style="width:10em;display:inline-block"></div>fieldValue:&nbsp;pub.util.deepCopy(e.app[appName].field[fieldName].fieldValue)
<a name="line1328"></a><div class="linenumber">1328</div><div style="width:8em;display:inline-block"></div>};
<a name="line1329"></a><div class="linenumber">1329</div><div style="width:6em;display:inline-block"></div>}
<a name="line1330"></a><div class="linenumber">1330</div><div style="width:4em;display:inline-block"></div>}
<a name="line1331"></a><div class="linenumber">1331</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;fieldObj);
<a name="line1332"></a><div class="linenumber">1332</div><div style="width:2em;display:inline-block"></div>};
<a name="line1333"></a><div class="linenumber">1333</div><div style="width:0em;display:inline-block"></div>
<a name="line1334"></a><div class="linenumber">1334</div><div style="width:0em;display:inline-block"></div>
<a name="line1335"></a><div class="linenumber">1335</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1336"></a><div class="linenumber">1336</div><div style="width:2em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;array&nbsp;of&nbsp;all&nbsp;group&nbsp;names&nbsp;within&nbsp;the&nbsp;application
<a name="line1337"></a><div class="linenumber">1337</div><div style="width:2em;display:inline-block"></div>*
<a name="line1338"></a><div class="linenumber">1338</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1339"></a><div class="linenumber">1339</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Array.&lt;string&gt;)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;of&nbsp;group&nbsp;names.
<a name="line1340"></a><div class="linenumber">1340</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1341"></a><div class="linenumber">1341</div><div style="width:2em;display:inline-block"></div>appObj.getGroupNames&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line1342"></a><div class="linenumber">1342</div><div style="width:4em;display:inline-block"></div>var&nbsp;groupNames&nbsp;=&nbsp;[];
<a name="line1343"></a><div class="linenumber">1343</div><div style="width:4em;display:inline-block"></div>for&nbsp;(var&nbsp;key&nbsp;in&nbsp;e.app[appName].group)&nbsp;{
<a name="line1344"></a><div class="linenumber">1344</div><div style="width:6em;display:inline-block"></div>groupNames.push(key);
<a name="line1345"></a><div class="linenumber">1345</div><div style="width:4em;display:inline-block"></div>}
<a name="line1346"></a><div class="linenumber">1346</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;groupNames);
<a name="line1347"></a><div class="linenumber">1347</div><div style="width:2em;display:inline-block"></div>};
<a name="line1348"></a><div class="linenumber">1348</div><div style="width:0em;display:inline-block"></div>
<a name="line1349"></a><div class="linenumber">1349</div><div style="width:0em;display:inline-block"></div>
<a name="line1350"></a><div class="linenumber">1350</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1351"></a><div class="linenumber">1351</div><div style="width:2em;display:inline-block"></div>*&nbsp;Gets&nbsp;individual&nbsp;option&nbsp;value.&nbsp;Will&nbsp;first&nbsp;check&nbsp;if&nbsp;option&nbsp;is&nbsp;defined&nbsp;for&nbsp;the&nbsp;application,&nbsp;else&nbsp;it&nbsp;will&nbsp;revert&nbsp;to&nbsp;the&nbsp;global&nbsp;level&nbsp;option.
<a name="line1352"></a><div class="linenumber">1352</div><div style="width:2em;display:inline-block"></div>*
<a name="line1353"></a><div class="linenumber">1353</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1354"></a><div class="linenumber">1354</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;&nbsp;&nbsp;&nbsp;optionName&nbsp;&nbsp;Option&nbsp;name
<a name="line1355"></a><div class="linenumber">1355</div><div style="width:2em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{*}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Option&nbsp;value&nbsp;(can&nbsp;be&nbsp;any&nbsp;JSON&nbsp;type)
<a name="line1356"></a><div class="linenumber">1356</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1357"></a><div class="linenumber">1357</div><div style="width:2em;display:inline-block"></div>appObj.getOption&nbsp;=&nbsp;function(optionName)&nbsp;{
<a name="line1358"></a><div class="linenumber">1358</div><div style="width:4em;display:inline-block"></div>return&nbsp;((e.app[appName].option[optionName]&nbsp;===&nbsp;undefined)&nbsp;?&nbsp;pub.getOption(optionName)&nbsp;:&nbsp;(e.app[appName].option[optionName]));
<a name="line1359"></a><div class="linenumber">1359</div><div style="width:2em;display:inline-block"></div>};
<a name="line1360"></a><div class="linenumber">1360</div><div style="width:0em;display:inline-block"></div>
<a name="line1361"></a><div class="linenumber">1361</div><div style="width:0em;display:inline-block"></div>
<a name="line1362"></a><div class="linenumber">1362</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1363"></a><div class="linenumber">1363</div><div style="width:2em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;array&nbsp;of&nbsp;all&nbsp;room&nbsp;names&nbsp;within&nbsp;the&nbsp;application.
<a name="line1364"></a><div class="linenumber">1364</div><div style="width:2em;display:inline-block"></div>*
<a name="line1365"></a><div class="linenumber">1365</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1366"></a><div class="linenumber">1366</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Array.&lt;string&gt;)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;of&nbsp;room&nbsp;names.
<a name="line1367"></a><div class="linenumber">1367</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1368"></a><div class="linenumber">1368</div><div style="width:2em;display:inline-block"></div>appObj.getRoomNames&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line1369"></a><div class="linenumber">1369</div><div style="width:4em;display:inline-block"></div>var&nbsp;roomNames&nbsp;=&nbsp;[];
<a name="line1370"></a><div class="linenumber">1370</div><div style="width:4em;display:inline-block"></div>for&nbsp;(var&nbsp;key&nbsp;in&nbsp;e.app[appName].room)&nbsp;{
<a name="line1371"></a><div class="linenumber">1371</div><div style="width:6em;display:inline-block"></div>roomNames.push(key);
<a name="line1372"></a><div class="linenumber">1372</div><div style="width:4em;display:inline-block"></div>}
<a name="line1373"></a><div class="linenumber">1373</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;roomNames);
<a name="line1374"></a><div class="linenumber">1374</div><div style="width:2em;display:inline-block"></div>};
<a name="line1375"></a><div class="linenumber">1375</div><div style="width:0em;display:inline-block"></div>
<a name="line1376"></a><div class="linenumber">1376</div><div style="width:0em;display:inline-block"></div>
<a name="line1377"></a><div class="linenumber">1377</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1378"></a><div class="linenumber">1378</div><div style="width:2em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;array&nbsp;of&nbsp;all&nbsp;easyrtcsids&nbsp;within&nbsp;the&nbsp;application
<a name="line1379"></a><div class="linenumber">1379</div><div style="width:2em;display:inline-block"></div>*
<a name="line1380"></a><div class="linenumber">1380</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1381"></a><div class="linenumber">1381</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Array.&lt;string&gt;)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;containing&nbsp;easyrtcsids.
<a name="line1382"></a><div class="linenumber">1382</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1383"></a><div class="linenumber">1383</div><div style="width:2em;display:inline-block"></div>appObj.getEasyrtcsids&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line1384"></a><div class="linenumber">1384</div><div style="width:4em;display:inline-block"></div>var&nbsp;easyrtcsids&nbsp;=&nbsp;[];
<a name="line1385"></a><div class="linenumber">1385</div><div style="width:4em;display:inline-block"></div>for&nbsp;(var&nbsp;key&nbsp;in&nbsp;e.app[appName].session)&nbsp;{
<a name="line1386"></a><div class="linenumber">1386</div><div style="width:6em;display:inline-block"></div>easyrtcsids.push(key);
<a name="line1387"></a><div class="linenumber">1387</div><div style="width:4em;display:inline-block"></div>}
<a name="line1388"></a><div class="linenumber">1388</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;easyrtcsids);
<a name="line1389"></a><div class="linenumber">1389</div><div style="width:2em;display:inline-block"></div>};
<a name="line1390"></a><div class="linenumber">1390</div><div style="width:0em;display:inline-block"></div>
<a name="line1391"></a><div class="linenumber">1391</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1392"></a><div class="linenumber">1392</div><div style="width:2em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;array&nbsp;of&nbsp;all&nbsp;easyrtcsids&nbsp;within&nbsp;the&nbsp;application.&nbsp;Old&nbsp;SessionKey&nbsp;name&nbsp;kept&nbsp;for&nbsp;transition&nbsp;purposes.&nbsp;Use&nbsp;getEasyrtcsid();
<a name="line1393"></a><div class="linenumber">1393</div><div style="width:2em;display:inline-block"></div>*
<a name="line1394"></a><div class="linenumber">1394</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1395"></a><div class="linenumber">1395</div><div style="width:2em;display:inline-block"></div>*&nbsp;@ignore
<a name="line1396"></a><div class="linenumber">1396</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1397"></a><div class="linenumber">1397</div><div style="width:2em;display:inline-block"></div>appObj.getSessionKeys&nbsp;=&nbsp;appObj.getEasyrtcsids;
<a name="line1398"></a><div class="linenumber">1398</div><div style="width:0em;display:inline-block"></div>
<a name="line1399"></a><div class="linenumber">1399</div><div style="width:0em;display:inline-block"></div>
<a name="line1400"></a><div class="linenumber">1400</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1401"></a><div class="linenumber">1401</div><div style="width:2em;display:inline-block"></div>*&nbsp;Gets&nbsp;connection&nbsp;status&nbsp;for&nbsp;a&nbsp;connection.&nbsp;It&nbsp;is&nbsp;possible&nbsp;for&nbsp;a&nbsp;connection&nbsp;to&nbsp;be&nbsp;considered&nbsp;connected&nbsp;without&nbsp;being&nbsp;authenticated.
<a name="line1402"></a><div class="linenumber">1402</div><div style="width:2em;display:inline-block"></div>*
<a name="line1403"></a><div class="linenumber">1403</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1404"></a><div class="linenumber">1404</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;a&nbsp;socket&nbsp;connection.
<a name="line1405"></a><div class="linenumber">1405</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Boolean)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;a&nbsp;boolean&nbsp;indicating&nbsp;if&nbsp;easyrtcid&nbsp;is&nbsp;connected.
<a name="line1406"></a><div class="linenumber">1406</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1407"></a><div class="linenumber">1407</div><div style="width:2em;display:inline-block"></div>appObj.isConnected&nbsp;=&nbsp;function(easyrtcid,&nbsp;callback)&nbsp;{
<a name="line1408"></a><div class="linenumber">1408</div><div style="width:4em;display:inline-block"></div>if&nbsp;(e.app[appName]&nbsp;&amp;&amp;&nbsp;e.app[appName].connection&nbsp;&amp;&amp;&nbsp;e.app[appName].connection[easyrtcid])&nbsp;{
<a name="line1409"></a><div class="linenumber">1409</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;true);
<a name="line1410"></a><div class="linenumber">1410</div><div style="width:4em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line1411"></a><div class="linenumber">1411</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;false);
<a name="line1412"></a><div class="linenumber">1412</div><div style="width:4em;display:inline-block"></div>}
<a name="line1413"></a><div class="linenumber">1413</div><div style="width:2em;display:inline-block"></div>};
<a name="line1414"></a><div class="linenumber">1414</div><div style="width:0em;display:inline-block"></div>
<a name="line1415"></a><div class="linenumber">1415</div><div style="width:0em;display:inline-block"></div>
<a name="line1416"></a><div class="linenumber">1416</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1417"></a><div class="linenumber">1417</div><div style="width:2em;display:inline-block"></div>*&nbsp;Gets&nbsp;connection&nbsp;status&nbsp;for&nbsp;a&nbsp;connection.&nbsp;It&nbsp;is&nbsp;possible&nbsp;for&nbsp;a&nbsp;connection&nbsp;to&nbsp;be&nbsp;considered&nbsp;connected&nbsp;without&nbsp;being&nbsp;authenticated.&nbsp;Synchronous&nbsp;function.
<a name="line1418"></a><div class="linenumber">1418</div><div style="width:2em;display:inline-block"></div>*
<a name="line1419"></a><div class="linenumber">1419</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1420"></a><div class="linenumber">1420</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;a&nbsp;socket&nbsp;connection.
<a name="line1421"></a><div class="linenumber">1421</div><div style="width:2em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{boolean}
<a name="line1422"></a><div class="linenumber">1422</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1423"></a><div class="linenumber">1423</div><div style="width:2em;display:inline-block"></div>appObj.isConnectedSync&nbsp;=&nbsp;function(easyrtcid)&nbsp;{
<a name="line1424"></a><div class="linenumber">1424</div><div style="width:4em;display:inline-block"></div>if&nbsp;(e.app[appName]&nbsp;&amp;&amp;&nbsp;e.app[appName].connection&nbsp;&amp;&amp;&nbsp;e.app[appName].connection[easyrtcid])&nbsp;{
<a name="line1425"></a><div class="linenumber">1425</div><div style="width:6em;display:inline-block"></div>return&nbsp;true;
<a name="line1426"></a><div class="linenumber">1426</div><div style="width:4em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line1427"></a><div class="linenumber">1427</div><div style="width:6em;display:inline-block"></div>return&nbsp;false;
<a name="line1428"></a><div class="linenumber">1428</div><div style="width:4em;display:inline-block"></div>}
<a name="line1429"></a><div class="linenumber">1429</div><div style="width:2em;display:inline-block"></div>};
<a name="line1430"></a><div class="linenumber">1430</div><div style="width:0em;display:inline-block"></div>
<a name="line1431"></a><div class="linenumber">1431</div><div style="width:0em;display:inline-block"></div>
<a name="line1432"></a><div class="linenumber">1432</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1433"></a><div class="linenumber">1433</div><div style="width:2em;display:inline-block"></div>*&nbsp;Sets&nbsp;individual&nbsp;option.&nbsp;Set&nbsp;value&nbsp;to&nbsp;NULL&nbsp;to&nbsp;delete&nbsp;the&nbsp;option&nbsp;(thus&nbsp;reverting&nbsp;to&nbsp;global&nbsp;option).
<a name="line1434"></a><div class="linenumber">1434</div><div style="width:2em;display:inline-block"></div>*
<a name="line1435"></a><div class="linenumber">1435</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1436"></a><div class="linenumber">1436</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;&nbsp;&nbsp;&nbsp;optionName&nbsp;&nbsp;Option&nbsp;name
<a name="line1437"></a><div class="linenumber">1437</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;optionValue&nbsp;Option&nbsp;value
<a name="line1438"></a><div class="linenumber">1438</div><div style="width:2em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Boolean}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true&nbsp;on&nbsp;success,&nbsp;false&nbsp;on&nbsp;failure
<a name="line1439"></a><div class="linenumber">1439</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1440"></a><div class="linenumber">1440</div><div style="width:2em;display:inline-block"></div>appObj.setOption&nbsp;=&nbsp;function(optionName,&nbsp;optionValue)&nbsp;{
<a name="line1441"></a><div class="linenumber">1441</div><div style="width:4em;display:inline-block"></div>//&nbsp;Can&nbsp;only&nbsp;set&nbsp;options&nbsp;which&nbsp;currently&nbsp;exist
<a name="line1442"></a><div class="linenumber">1442</div><div style="width:4em;display:inline-block"></div>if&nbsp;(typeof&nbsp;e.option[optionName]&nbsp;==&nbsp;"undefined")&nbsp;{
<a name="line1443"></a><div class="linenumber">1443</div><div style="width:6em;display:inline-block"></div>pub.util.logError("Error&nbsp;setting&nbsp;option.&nbsp;Unrecognised&nbsp;option&nbsp;name&nbsp;'"&nbsp;+&nbsp;optionName&nbsp;+&nbsp;"'.");
<a name="line1444"></a><div class="linenumber">1444</div><div style="width:6em;display:inline-block"></div>return&nbsp;false;
<a name="line1445"></a><div class="linenumber">1445</div><div style="width:4em;display:inline-block"></div>}
<a name="line1446"></a><div class="linenumber">1446</div><div style="width:0em;display:inline-block"></div>
<a name="line1447"></a><div class="linenumber">1447</div><div style="width:4em;display:inline-block"></div>//&nbsp;If&nbsp;value&nbsp;is&nbsp;null,&nbsp;delete&nbsp;option&nbsp;from&nbsp;application&nbsp;(reverts&nbsp;to&nbsp;global&nbsp;option)
<a name="line1448"></a><div class="linenumber">1448</div><div style="width:4em;display:inline-block"></div>if&nbsp;(optionValue&nbsp;==&nbsp;null)&nbsp;{
<a name="line1449"></a><div class="linenumber">1449</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!(e.app[appName].option[optionName]&nbsp;===&nbsp;'undefined'))&nbsp;{
<a name="line1450"></a><div class="linenumber">1450</div><div style="width:8em;display:inline-block"></div>delete&nbsp;e.app[appName].option[optionName];
<a name="line1451"></a><div class="linenumber">1451</div><div style="width:6em;display:inline-block"></div>}
<a name="line1452"></a><div class="linenumber">1452</div><div style="width:4em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line1453"></a><div class="linenumber">1453</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;the&nbsp;option&nbsp;value&nbsp;to&nbsp;be&nbsp;a&nbsp;full&nbsp;deep&nbsp;copy,&nbsp;thus&nbsp;preserving&nbsp;private&nbsp;nature&nbsp;of&nbsp;the&nbsp;private&nbsp;EasyRTC&nbsp;object.
<a name="line1454"></a><div class="linenumber">1454</div><div style="width:6em;display:inline-block"></div>e.app[appName].option[optionName]&nbsp;=&nbsp;pub.util.deepCopy(optionValue);
<a name="line1455"></a><div class="linenumber">1455</div><div style="width:4em;display:inline-block"></div>}
<a name="line1456"></a><div class="linenumber">1456</div><div style="width:4em;display:inline-block"></div>return&nbsp;true;
<a name="line1457"></a><div class="linenumber">1457</div><div style="width:2em;display:inline-block"></div>};
<a name="line1458"></a><div class="linenumber">1458</div><div style="width:0em;display:inline-block"></div>
<a name="line1459"></a><div class="linenumber">1459</div><div style="width:0em;display:inline-block"></div>
<a name="line1460"></a><div class="linenumber">1460</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1461"></a><div class="linenumber">1461</div><div style="width:2em;display:inline-block"></div>*&nbsp;Sets&nbsp;application&nbsp;field&nbsp;value&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.
<a name="line1462"></a><div class="linenumber">1462</div><div style="width:2em;display:inline-block"></div>*
<a name="line1463"></a><div class="linenumber">1463</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1464"></a><div class="linenumber">1464</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Must&nbsp;be&nbsp;formatted&nbsp;according&nbsp;to&nbsp;"fieldNameRegExp"&nbsp;option.
<a name="line1465"></a><div class="linenumber">1465</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;fieldValue
<a name="line1466"></a><div class="linenumber">1466</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?Object}&nbsp;&nbsp;&nbsp;fieldOption&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;options&nbsp;(such&nbsp;as&nbsp;isShared&nbsp;which&nbsp;defaults&nbsp;to&nbsp;false)
<a name="line1467"></a><div class="linenumber">1467</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;[next]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1468"></a><div class="linenumber">1468</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1469"></a><div class="linenumber">1469</div><div style="width:2em;display:inline-block"></div>appObj.setField&nbsp;=&nbsp;function(fieldName,&nbsp;fieldValue,&nbsp;fieldOption,&nbsp;next)&nbsp;{
<a name="line1470"></a><div class="linenumber">1470</div><div style="width:4em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]&nbsp;Setting&nbsp;field&nbsp;["&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"]",&nbsp;fieldValue);
<a name="line1471"></a><div class="linenumber">1471</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!_.isFunction(next))&nbsp;{
<a name="line1472"></a><div class="linenumber">1472</div><div style="width:6em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1473"></a><div class="linenumber">1473</div><div style="width:4em;display:inline-block"></div>}
<a name="line1474"></a><div class="linenumber">1474</div><div style="width:0em;display:inline-block"></div>
<a name="line1475"></a><div class="linenumber">1475</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!pub.getOption("fieldNameRegExp").test(fieldName))&nbsp;{
<a name="line1476"></a><div class="linenumber">1476</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;application&nbsp;field&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'");
<a name="line1477"></a><div class="linenumber">1477</div><div style="width:6em;display:inline-block"></div>next(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;create&nbsp;application&nbsp;field&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'"));
<a name="line1478"></a><div class="linenumber">1478</div><div style="width:6em;display:inline-block"></div>return;
<a name="line1479"></a><div class="linenumber">1479</div><div style="width:4em;display:inline-block"></div>}
<a name="line1480"></a><div class="linenumber">1480</div><div style="width:4em;display:inline-block"></div>e.app[appName].field[fieldName]&nbsp;=&nbsp;{
<a name="line1481"></a><div class="linenumber">1481</div><div style="width:6em;display:inline-block"></div>fieldName:&nbsp;fieldName,
<a name="line1482"></a><div class="linenumber">1482</div><div style="width:6em;display:inline-block"></div>fieldValue:&nbsp;fieldValue,
<a name="line1483"></a><div class="linenumber">1483</div><div style="width:6em;display:inline-block"></div>fieldOption:&nbsp;{isShared:&nbsp;((_.isObject(fieldOption)&nbsp;&amp;&amp;&nbsp;fieldOption.isShared)&nbsp;?&nbsp;true&nbsp;:&nbsp;false)}
<a name="line1484"></a><div class="linenumber">1484</div><div style="width:4em;display:inline-block"></div>};
<a name="line1485"></a><div class="linenumber">1485</div><div style="width:0em;display:inline-block"></div>
<a name="line1486"></a><div class="linenumber">1486</div><div style="width:4em;display:inline-block"></div>next(null);
<a name="line1487"></a><div class="linenumber">1487</div><div style="width:2em;display:inline-block"></div>};
<a name="line1488"></a><div class="linenumber">1488</div><div style="width:0em;display:inline-block"></div>
<a name="line1489"></a><div class="linenumber">1489</div><div style="width:0em;display:inline-block"></div>
<a name="line1490"></a><div class="linenumber">1490</div><div style="width:2em;display:inline-block"></div>/**
<a name="line1491"></a><div class="linenumber">1491</div><div style="width:2em;display:inline-block"></div>*&nbsp;Gets&nbsp;connection&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;connection&nbsp;key.&nbsp;Returns&nbsp;null&nbsp;if&nbsp;connection&nbsp;not&nbsp;found.
<a name="line1492"></a><div class="linenumber">1492</div><div style="width:2em;display:inline-block"></div>*&nbsp;The&nbsp;returned&nbsp;connection&nbsp;object&nbsp;includes&nbsp;functions&nbsp;for&nbsp;managing&nbsp;connection&nbsp;fields.
<a name="line1493"></a><div class="linenumber">1493</div><div style="width:2em;display:inline-block"></div>*
<a name="line1494"></a><div class="linenumber">1494</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1495"></a><div class="linenumber">1495</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;a&nbsp;socket&nbsp;connection.
<a name="line1496"></a><div class="linenumber">1496</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{connectionCallback}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;EasyRTC&nbsp;connection&nbsp;object.
<a name="line1497"></a><div class="linenumber">1497</div><div style="width:2em;display:inline-block"></div>*/
<a name="line1498"></a><div class="linenumber">1498</div><div style="width:2em;display:inline-block"></div>appObj.connection&nbsp;=&nbsp;function(easyrtcid,&nbsp;callback)&nbsp;{
<a name="line1499"></a><div class="linenumber">1499</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!e.app[appName].connection[easyrtcid])&nbsp;{
<a name="line1500"></a><div class="linenumber">1500</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;connection&nbsp;key:&nbsp;'"&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"'");
<a name="line1501"></a><div class="linenumber">1501</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;connection&nbsp;key:&nbsp;'"&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"'"));
<a name="line1502"></a><div class="linenumber">1502</div><div style="width:6em;display:inline-block"></div>return;
<a name="line1503"></a><div class="linenumber">1503</div><div style="width:4em;display:inline-block"></div>}
<a name="line1504"></a><div class="linenumber">1504</div><div style="width:0em;display:inline-block"></div>
<a name="line1505"></a><div class="linenumber">1505</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!pub.socketServer)&nbsp;{
<a name="line1506"></a><div class="linenumber">1506</div><div style="width:6em;display:inline-block"></div>pub.util.logError("Socket&nbsp;server&nbsp;undefined.");
<a name="line1507"></a><div class="linenumber">1507</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;socket:&nbsp;'"&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"'"));
<a name="line1508"></a><div class="linenumber">1508</div><div style="width:6em;display:inline-block"></div>return;
<a name="line1509"></a><div class="linenumber">1509</div><div style="width:4em;display:inline-block"></div>}
<a name="line1510"></a><div class="linenumber">1510</div><div style="width:0em;display:inline-block"></div>
<a name="line1511"></a><div class="linenumber">1511</div><div style="width:4em;display:inline-block"></div>var&nbsp;socketId&nbsp;=&nbsp;e.app[appName].connection[easyrtcid].socketId;
<a name="line1512"></a><div class="linenumber">1512</div><div style="width:0em;display:inline-block"></div>
<a name="line1513"></a><div class="linenumber">1513</div><div style="width:4em;display:inline-block"></div>if&nbsp;(pub.socketServer.sockets.connected){
<a name="line1514"></a><div class="linenumber">1514</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!pub.socketServer.sockets.connected[socketId]&nbsp;||&nbsp;pub.socketServer.sockets.connected[socketId].disconnected)&nbsp;{
<a name="line1515"></a><div class="linenumber">1515</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+easyrtcid+"]&nbsp;Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;socket:&nbsp;'"&nbsp;+&nbsp;socketId&nbsp;+&nbsp;"'");
<a name="line1516"></a><div class="linenumber">1516</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;socket:&nbsp;'"&nbsp;+&nbsp;socketId&nbsp;+&nbsp;"'"));
<a name="line1517"></a><div class="linenumber">1517</div><div style="width:8em;display:inline-block"></div>return;
<a name="line1518"></a><div class="linenumber">1518</div><div style="width:6em;display:inline-block"></div>}
<a name="line1519"></a><div class="linenumber">1519</div><div style="width:0em;display:inline-block"></div>
<a name="line1520"></a><div class="linenumber">1520</div><div style="width:6em;display:inline-block"></div>if&nbsp;(pub.socketServer.sockets.connected[socketId].disconnected)&nbsp;{
<a name="line1521"></a><div class="linenumber">1521</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+easyrtcid+"]&nbsp;Attempt&nbsp;to&nbsp;request&nbsp;disconnected&nbsp;socket:&nbsp;'"&nbsp;+&nbsp;socketId&nbsp;+&nbsp;"'");
<a name="line1522"></a><div class="linenumber">1522</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Attempt&nbsp;to&nbsp;request&nbsp;disconnected&nbsp;socket:&nbsp;'"&nbsp;+&nbsp;socketId&nbsp;+&nbsp;"'"));
<a name="line1523"></a><div class="linenumber">1523</div><div style="width:8em;display:inline-block"></div>return;
<a name="line1524"></a><div class="linenumber">1524</div><div style="width:6em;display:inline-block"></div>}
<a name="line1525"></a><div class="linenumber">1525</div><div style="width:4em;display:inline-block"></div>}
<a name="line1526"></a><div class="linenumber">1526</div><div style="width:4em;display:inline-block"></div>else&nbsp;{
<a name="line1527"></a><div class="linenumber">1527</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!pub.socketServer.sockets.sockets[socketId]&nbsp;||&nbsp;pub.socketServer.sockets.sockets[socketId].disconnected)&nbsp;{
<a name="line1528"></a><div class="linenumber">1528</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+easyrtcid+"]&nbsp;Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;socket:&nbsp;'"&nbsp;+&nbsp;socketId&nbsp;+&nbsp;"'");
<a name="line1529"></a><div class="linenumber">1529</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;socket:&nbsp;'"&nbsp;+&nbsp;socketId&nbsp;+&nbsp;"'"));
<a name="line1530"></a><div class="linenumber">1530</div><div style="width:8em;display:inline-block"></div>return;
<a name="line1531"></a><div class="linenumber">1531</div><div style="width:6em;display:inline-block"></div>}
<a name="line1532"></a><div class="linenumber">1532</div><div style="width:0em;display:inline-block"></div>
<a name="line1533"></a><div class="linenumber">1533</div><div style="width:6em;display:inline-block"></div>if&nbsp;(pub.socketServer.sockets.sockets[socketId].disconnected)&nbsp;{
<a name="line1534"></a><div class="linenumber">1534</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+easyrtcid+"]&nbsp;Attempt&nbsp;to&nbsp;request&nbsp;disconnected&nbsp;socket:&nbsp;'"&nbsp;+&nbsp;socketId&nbsp;+&nbsp;"'");
<a name="line1535"></a><div class="linenumber">1535</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Attempt&nbsp;to&nbsp;request&nbsp;disconnected&nbsp;socket:&nbsp;'"&nbsp;+&nbsp;socketId&nbsp;+&nbsp;"'"));
<a name="line1536"></a><div class="linenumber">1536</div><div style="width:8em;display:inline-block"></div>return;
<a name="line1537"></a><div class="linenumber">1537</div><div style="width:6em;display:inline-block"></div>}
<a name="line1538"></a><div class="linenumber">1538</div><div style="width:4em;display:inline-block"></div>}
<a name="line1539"></a><div class="linenumber">1539</div><div style="width:0em;display:inline-block"></div>
<a name="line1540"></a><div class="linenumber">1540</div><div style="width:0em;display:inline-block"></div>
<a name="line1541"></a><div class="linenumber">1541</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1542"></a><div class="linenumber">1542</div><div style="width:4em;display:inline-block"></div>*&nbsp;@class&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connectionObj
<a name="line1543"></a><div class="linenumber">1543</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line1544"></a><div class="linenumber">1544</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1545"></a><div class="linenumber">1545</div><div style="width:4em;display:inline-block"></div>var&nbsp;connectionObj&nbsp;=&nbsp;{};
<a name="line1546"></a><div class="linenumber">1546</div><div style="width:0em;display:inline-block"></div>
<a name="line1547"></a><div class="linenumber">1547</div><div style="width:4em;display:inline-block"></div>//&nbsp;House&nbsp;the&nbsp;local&nbsp;session&nbsp;object
<a name="line1548"></a><div class="linenumber">1548</div><div style="width:4em;display:inline-block"></div>var&nbsp;_sessionObj;
<a name="line1549"></a><div class="linenumber">1549</div><div style="width:0em;display:inline-block"></div>
<a name="line1550"></a><div class="linenumber">1550</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1551"></a><div class="linenumber">1551</div><div style="width:4em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;event&nbsp;functions
<a name="line1552"></a><div class="linenumber">1552</div><div style="width:4em;display:inline-block"></div>*&nbsp;
<a name="line1553"></a><div class="linenumber">1553</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1554"></a><div class="linenumber">1554</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1555"></a><div class="linenumber">1555</div><div style="width:4em;display:inline-block"></div>connectionObj.events&nbsp;=&nbsp;pub.events;
<a name="line1556"></a><div class="linenumber">1556</div><div style="width:0em;display:inline-block"></div>
<a name="line1557"></a><div class="linenumber">1557</div><div style="width:0em;display:inline-block"></div>
<a name="line1558"></a><div class="linenumber">1558</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1559"></a><div class="linenumber">1559</div><div style="width:4em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;utility&nbsp;functions
<a name="line1560"></a><div class="linenumber">1560</div><div style="width:4em;display:inline-block"></div>*&nbsp;
<a name="line1561"></a><div class="linenumber">1561</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1562"></a><div class="linenumber">1562</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1563"></a><div class="linenumber">1563</div><div style="width:4em;display:inline-block"></div>connectionObj.util&nbsp;=&nbsp;pub.util;
<a name="line1564"></a><div class="linenumber">1564</div><div style="width:0em;display:inline-block"></div>
<a name="line1565"></a><div class="linenumber">1565</div><div style="width:0em;display:inline-block"></div>
<a name="line1566"></a><div class="linenumber">1566</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1567"></a><div class="linenumber">1567</div><div style="width:4em;display:inline-block"></div>*&nbsp;Reference&nbsp;to&nbsp;connection's&nbsp;socket.io&nbsp;object.&nbsp;See&nbsp;http://socket.io/&nbsp;for&nbsp;more&nbsp;information.
<a name="line1568"></a><div class="linenumber">1568</div><div style="width:4em;display:inline-block"></div>*
<a name="line1569"></a><div class="linenumber">1569</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1570"></a><div class="linenumber">1570</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1571"></a><div class="linenumber">1571</div><div style="width:4em;display:inline-block"></div>if&nbsp;(pub.socketServer.sockets.connected){
<a name="line1572"></a><div class="linenumber">1572</div><div style="width:6em;display:inline-block"></div>connectionObj.socket&nbsp;=&nbsp;pub.socketServer.sockets.connected[socketId];
<a name="line1573"></a><div class="linenumber">1573</div><div style="width:4em;display:inline-block"></div>}
<a name="line1574"></a><div class="linenumber">1574</div><div style="width:4em;display:inline-block"></div>else&nbsp;{
<a name="line1575"></a><div class="linenumber">1575</div><div style="width:6em;display:inline-block"></div>connectionObj.socket&nbsp;=&nbsp;pub.socketServer.sockets.sockets[socketId];
<a name="line1576"></a><div class="linenumber">1576</div><div style="width:4em;display:inline-block"></div>}
<a name="line1577"></a><div class="linenumber">1577</div><div style="width:0em;display:inline-block"></div>
<a name="line1578"></a><div class="linenumber">1578</div><div style="width:0em;display:inline-block"></div>
<a name="line1579"></a><div class="linenumber">1579</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1580"></a><div class="linenumber">1580</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;application&nbsp;object&nbsp;to&nbsp;which&nbsp;the&nbsp;connection&nbsp;belongs.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line1581"></a><div class="linenumber">1581</div><div style="width:4em;display:inline-block"></div>*
<a name="line1582"></a><div class="linenumber">1582</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1583"></a><div class="linenumber">1583</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;application&nbsp;object
<a name="line1584"></a><div class="linenumber">1584</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1585"></a><div class="linenumber">1585</div><div style="width:4em;display:inline-block"></div>connectionObj.getApp&nbsp;=&nbsp;function()&nbsp;{
<a name="line1586"></a><div class="linenumber">1586</div><div style="width:6em;display:inline-block"></div>return&nbsp;appObj;
<a name="line1587"></a><div class="linenumber">1587</div><div style="width:4em;display:inline-block"></div>};
<a name="line1588"></a><div class="linenumber">1588</div><div style="width:0em;display:inline-block"></div>
<a name="line1589"></a><div class="linenumber">1589</div><div style="width:0em;display:inline-block"></div>
<a name="line1590"></a><div class="linenumber">1590</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1591"></a><div class="linenumber">1591</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;application&nbsp;name&nbsp;for&nbsp;the&nbsp;application&nbsp;to&nbsp;which&nbsp;the&nbsp;connection&nbsp;belongs.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line1592"></a><div class="linenumber">1592</div><div style="width:4em;display:inline-block"></div>*
<a name="line1593"></a><div class="linenumber">1593</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1594"></a><div class="linenumber">1594</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;application&nbsp;name
<a name="line1595"></a><div class="linenumber">1595</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1596"></a><div class="linenumber">1596</div><div style="width:4em;display:inline-block"></div>connectionObj.getAppName&nbsp;=&nbsp;function()&nbsp;{
<a name="line1597"></a><div class="linenumber">1597</div><div style="width:6em;display:inline-block"></div>return&nbsp;appName;
<a name="line1598"></a><div class="linenumber">1598</div><div style="width:4em;display:inline-block"></div>};
<a name="line1599"></a><div class="linenumber">1599</div><div style="width:0em;display:inline-block"></div>
<a name="line1600"></a><div class="linenumber">1600</div><div style="width:0em;display:inline-block"></div>
<a name="line1601"></a><div class="linenumber">1601</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1602"></a><div class="linenumber">1602</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;easyrtcid&nbsp;for&nbsp;the&nbsp;connection.&nbsp;&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line1603"></a><div class="linenumber">1603</div><div style="width:4em;display:inline-block"></div>*
<a name="line1604"></a><div class="linenumber">1604</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1605"></a><div class="linenumber">1605</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;the&nbsp;connection's&nbsp;easyrtcid,&nbsp;which&nbsp;is&nbsp;the&nbsp;EasyRTC&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;a&nbsp;socket&nbsp;connection.
<a name="line1606"></a><div class="linenumber">1606</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1607"></a><div class="linenumber">1607</div><div style="width:4em;display:inline-block"></div>connectionObj.getEasyrtcid&nbsp;=&nbsp;function()&nbsp;{
<a name="line1608"></a><div class="linenumber">1608</div><div style="width:6em;display:inline-block"></div>return&nbsp;easyrtcid;
<a name="line1609"></a><div class="linenumber">1609</div><div style="width:4em;display:inline-block"></div>};
<a name="line1610"></a><div class="linenumber">1610</div><div style="width:0em;display:inline-block"></div>
<a name="line1611"></a><div class="linenumber">1611</div><div style="width:0em;display:inline-block"></div>
<a name="line1612"></a><div class="linenumber">1612</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1613"></a><div class="linenumber">1613</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;connection&nbsp;level&nbsp;field&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.
<a name="line1614"></a><div class="linenumber">1614</div><div style="width:4em;display:inline-block"></div>*
<a name="line1615"></a><div class="linenumber">1615</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1616"></a><div class="linenumber">1616</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line1617"></a><div class="linenumber">1617</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;field&nbsp;object&nbsp;(any&nbsp;type)
<a name="line1618"></a><div class="linenumber">1618</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1619"></a><div class="linenumber">1619</div><div style="width:4em;display:inline-block"></div>connectionObj.getField&nbsp;=&nbsp;function(fieldName,&nbsp;callback)&nbsp;{
<a name="line1620"></a><div class="linenumber">1620</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!e.app[appName].connection[easyrtcid].field[fieldName])&nbsp;{
<a name="line1621"></a><div class="linenumber">1621</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("Can&nbsp;not&nbsp;find&nbsp;connection&nbsp;field:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'");
<a name="line1622"></a><div class="linenumber">1622</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;find&nbsp;connection&nbsp;field:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'"));
<a name="line1623"></a><div class="linenumber">1623</div><div style="width:8em;display:inline-block"></div>return;
<a name="line1624"></a><div class="linenumber">1624</div><div style="width:6em;display:inline-block"></div>}
<a name="line1625"></a><div class="linenumber">1625</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;pub.util.deepCopy(e.app[appName].connection[easyrtcid].field[fieldName]));
<a name="line1626"></a><div class="linenumber">1626</div><div style="width:4em;display:inline-block"></div>};
<a name="line1627"></a><div class="linenumber">1627</div><div style="width:0em;display:inline-block"></div>
<a name="line1628"></a><div class="linenumber">1628</div><div style="width:0em;display:inline-block"></div>
<a name="line1629"></a><div class="linenumber">1629</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1630"></a><div class="linenumber">1630</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;connection&nbsp;level&nbsp;field&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.&nbsp;If&nbsp;the&nbsp;field&nbsp;is&nbsp;not&nbsp;set,&nbsp;it&nbsp;will&nbsp;return&nbsp;a&nbsp;field&nbsp;object&nbsp;will&nbsp;a&nbsp;null&nbsp;field&nbsp;value.&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;synchronous&nbsp;function,&nbsp;thus&nbsp;may&nbsp;not&nbsp;be&nbsp;available&nbsp;in&nbsp;custom&nbsp;cases&nbsp;where&nbsp;state&nbsp;is&nbsp;not&nbsp;kept&nbsp;in&nbsp;memory.
<a name="line1631"></a><div class="linenumber">1631</div><div style="width:4em;display:inline-block"></div>*
<a name="line1632"></a><div class="linenumber">1632</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1633"></a><div class="linenumber">1633</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line1634"></a><div class="linenumber">1634</div><div style="width:4em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;object
<a name="line1635"></a><div class="linenumber">1635</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1636"></a><div class="linenumber">1636</div><div style="width:4em;display:inline-block"></div>connectionObj.getFieldSync&nbsp;=&nbsp;function(fieldName)&nbsp;{
<a name="line1637"></a><div class="linenumber">1637</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!e.app[appName].connection[easyrtcid].field[fieldName])&nbsp;{
<a name="line1638"></a><div class="linenumber">1638</div><div style="width:8em;display:inline-block"></div>return&nbsp;{"fieldName":&nbsp;fieldName,&nbsp;"fieldOption":&nbsp;{},&nbsp;"fieldValue":&nbsp;null};
<a name="line1639"></a><div class="linenumber">1639</div><div style="width:6em;display:inline-block"></div>}
<a name="line1640"></a><div class="linenumber">1640</div><div style="width:6em;display:inline-block"></div>return&nbsp;pub.util.deepCopy(e.app[appName].connection[easyrtcid].field[fieldName]);
<a name="line1641"></a><div class="linenumber">1641</div><div style="width:4em;display:inline-block"></div>};
<a name="line1642"></a><div class="linenumber">1642</div><div style="width:0em;display:inline-block"></div>
<a name="line1643"></a><div class="linenumber">1643</div><div style="width:0em;display:inline-block"></div>
<a name="line1644"></a><div class="linenumber">1644</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1645"></a><div class="linenumber">1645</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;connection&nbsp;level&nbsp;field&nbsp;value&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.&nbsp;If&nbsp;the&nbsp;field&nbsp;is&nbsp;not&nbsp;set,&nbsp;it&nbsp;will&nbsp;return&nbsp;a&nbsp;null&nbsp;field&nbsp;value.&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;synchronous&nbsp;function,&nbsp;thus&nbsp;may&nbsp;not&nbsp;be&nbsp;available&nbsp;in&nbsp;custom&nbsp;cases&nbsp;where&nbsp;state&nbsp;is&nbsp;not&nbsp;kept&nbsp;in&nbsp;memory.
<a name="line1646"></a><div class="linenumber">1646</div><div style="width:4em;display:inline-block"></div>*
<a name="line1647"></a><div class="linenumber">1647</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1648"></a><div class="linenumber">1648</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line1649"></a><div class="linenumber">1649</div><div style="width:4em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;value
<a name="line1650"></a><div class="linenumber">1650</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1651"></a><div class="linenumber">1651</div><div style="width:4em;display:inline-block"></div>connectionObj.getFieldValueSync&nbsp;=&nbsp;function(fieldName)&nbsp;{
<a name="line1652"></a><div class="linenumber">1652</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!e.app[appName].connection[easyrtcid].field[fieldName])&nbsp;{
<a name="line1653"></a><div class="linenumber">1653</div><div style="width:8em;display:inline-block"></div>return&nbsp;null;
<a name="line1654"></a><div class="linenumber">1654</div><div style="width:6em;display:inline-block"></div>}
<a name="line1655"></a><div class="linenumber">1655</div><div style="width:6em;display:inline-block"></div>return&nbsp;pub.util.deepCopy(e.app[appName].connection[easyrtcid].field[fieldName].fieldValue);
<a name="line1656"></a><div class="linenumber">1656</div><div style="width:4em;display:inline-block"></div>};
<a name="line1657"></a><div class="linenumber">1657</div><div style="width:0em;display:inline-block"></div>
<a name="line1658"></a><div class="linenumber">1658</div><div style="width:0em;display:inline-block"></div>
<a name="line1659"></a><div class="linenumber">1659</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1660"></a><div class="linenumber">1660</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;object&nbsp;containing&nbsp;all&nbsp;field&nbsp;names&nbsp;and&nbsp;values&nbsp;within&nbsp;the&nbsp;connection&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.&nbsp;Can&nbsp;be&nbsp;limited&nbsp;to&nbsp;fields&nbsp;with&nbsp;isShared&nbsp;option&nbsp;set&nbsp;to&nbsp;true.
<a name="line1661"></a><div class="linenumber">1661</div><div style="width:4em;display:inline-block"></div>*
<a name="line1662"></a><div class="linenumber">1662</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1663"></a><div class="linenumber">1663</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{boolean}&nbsp;&nbsp;&nbsp;limitToIsShared&nbsp;Limits&nbsp;returned&nbsp;fields&nbsp;to&nbsp;those&nbsp;which&nbsp;have&nbsp;the&nbsp;isShared&nbsp;option&nbsp;set&nbsp;to&nbsp;true.
<a name="line1664"></a><div class="linenumber">1664</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;field&nbsp;names&nbsp;and&nbsp;values.
<a name="line1665"></a><div class="linenumber">1665</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1666"></a><div class="linenumber">1666</div><div style="width:4em;display:inline-block"></div>connectionObj.getFields&nbsp;=&nbsp;function(limitToIsShared,&nbsp;callback)&nbsp;{
<a name="line1667"></a><div class="linenumber">1667</div><div style="width:6em;display:inline-block"></div>var&nbsp;fieldObj&nbsp;=&nbsp;{};
<a name="line1668"></a><div class="linenumber">1668</div><div style="width:6em;display:inline-block"></div>for&nbsp;(var&nbsp;fieldName&nbsp;in&nbsp;e.app[appName].connection[easyrtcid].field)&nbsp;{
<a name="line1669"></a><div class="linenumber">1669</div><div style="width:8em;display:inline-block"></div>if&nbsp;(!limitToIsShared&nbsp;||&nbsp;e.app[appName].connection[easyrtcid].field[fieldName].fieldOption.isShared)&nbsp;{
<a name="line1670"></a><div class="linenumber">1670</div><div style="width:10em;display:inline-block"></div>fieldObj[fieldName]&nbsp;=&nbsp;{
<a name="line1671"></a><div class="linenumber">1671</div><div style="width:12em;display:inline-block"></div>fieldName:&nbsp;fieldName,
<a name="line1672"></a><div class="linenumber">1672</div><div style="width:12em;display:inline-block"></div>fieldValue:&nbsp;pub.util.deepCopy(e.app[appName].connection[easyrtcid].field[fieldName].fieldValue)
<a name="line1673"></a><div class="linenumber">1673</div><div style="width:10em;display:inline-block"></div>};
<a name="line1674"></a><div class="linenumber">1674</div><div style="width:8em;display:inline-block"></div>}
<a name="line1675"></a><div class="linenumber">1675</div><div style="width:6em;display:inline-block"></div>}
<a name="line1676"></a><div class="linenumber">1676</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;fieldObj);
<a name="line1677"></a><div class="linenumber">1677</div><div style="width:4em;display:inline-block"></div>};
<a name="line1678"></a><div class="linenumber">1678</div><div style="width:0em;display:inline-block"></div>
<a name="line1679"></a><div class="linenumber">1679</div><div style="width:0em;display:inline-block"></div>
<a name="line1680"></a><div class="linenumber">1680</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1681"></a><div class="linenumber">1681</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;array&nbsp;of&nbsp;all&nbsp;room&nbsp;names&nbsp;which&nbsp;connection&nbsp;has&nbsp;entered.
<a name="line1682"></a><div class="linenumber">1682</div><div style="width:4em;display:inline-block"></div>*
<a name="line1683"></a><div class="linenumber">1683</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1684"></a><div class="linenumber">1684</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Array.&lt;string&gt;)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;of&nbsp;room&nbsp;names.
<a name="line1685"></a><div class="linenumber">1685</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1686"></a><div class="linenumber">1686</div><div style="width:4em;display:inline-block"></div>connectionObj.getRoomNames&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line1687"></a><div class="linenumber">1687</div><div style="width:6em;display:inline-block"></div>var&nbsp;roomNames&nbsp;=&nbsp;[];
<a name="line1688"></a><div class="linenumber">1688</div><div style="width:6em;display:inline-block"></div>for&nbsp;(var&nbsp;key&nbsp;in&nbsp;e.app[appName].connection[easyrtcid].room)&nbsp;{
<a name="line1689"></a><div class="linenumber">1689</div><div style="width:8em;display:inline-block"></div>roomNames.push(key);
<a name="line1690"></a><div class="linenumber">1690</div><div style="width:6em;display:inline-block"></div>}
<a name="line1691"></a><div class="linenumber">1691</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;roomNames);
<a name="line1692"></a><div class="linenumber">1692</div><div style="width:4em;display:inline-block"></div>};
<a name="line1693"></a><div class="linenumber">1693</div><div style="width:0em;display:inline-block"></div>
<a name="line1694"></a><div class="linenumber">1694</div><div style="width:0em;display:inline-block"></div>
<a name="line1695"></a><div class="linenumber">1695</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1696"></a><div class="linenumber">1696</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;session&nbsp;object&nbsp;to&nbsp;which&nbsp;the&nbsp;connection&nbsp;belongs&nbsp;(if&nbsp;one&nbsp;exists).&nbsp;Returns&nbsp;a&nbsp;null&nbsp;if&nbsp;connection&nbsp;is&nbsp;not&nbsp;attached&nbsp;to&nbsp;a&nbsp;session&nbsp;(such&nbsp;as&nbsp;when&nbsp;sessions&nbsp;are&nbsp;disabled).&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line1697"></a><div class="linenumber">1697</div><div style="width:4em;display:inline-block"></div>*
<a name="line1698"></a><div class="linenumber">1698</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1699"></a><div class="linenumber">1699</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;session&nbsp;object.&nbsp;May&nbsp;be&nbsp;null&nbsp;if&nbsp;connection&nbsp;has&nbsp;not&nbsp;been&nbsp;joined&nbsp;to&nbsp;a&nbsp;session.
<a name="line1700"></a><div class="linenumber">1700</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1701"></a><div class="linenumber">1701</div><div style="width:4em;display:inline-block"></div>connectionObj.getSession&nbsp;=&nbsp;function()&nbsp;{
<a name="line1702"></a><div class="linenumber">1702</div><div style="width:6em;display:inline-block"></div>return&nbsp;_sessionObj;
<a name="line1703"></a><div class="linenumber">1703</div><div style="width:4em;display:inline-block"></div>};
<a name="line1704"></a><div class="linenumber">1704</div><div style="width:0em;display:inline-block"></div>
<a name="line1705"></a><div class="linenumber">1705</div><div style="width:0em;display:inline-block"></div>
<a name="line1706"></a><div class="linenumber">1706</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1707"></a><div class="linenumber">1707</div><div style="width:4em;display:inline-block"></div>*&nbsp;TO&nbsp;BE&nbsp;REMOVED&nbsp;-&nbsp;Use&nbsp;getSession()&nbsp;instead.
<a name="line1708"></a><div class="linenumber">1708</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;session&nbsp;object&nbsp;which&nbsp;the&nbsp;connection&nbsp;belongs&nbsp;to.&nbsp;Will&nbsp;return&nbsp;null&nbsp;if&nbsp;connection&nbsp;is&nbsp;not&nbsp;in&nbsp;a&nbsp;session&nbsp;(such&nbsp;as&nbsp;if&nbsp;session&nbsp;handling&nbsp;is&nbsp;disabled).
<a name="line1709"></a><div class="linenumber">1709</div><div style="width:4em;display:inline-block"></div>*&nbsp;
<a name="line1710"></a><div class="linenumber">1710</div><div style="width:4em;display:inline-block"></div>*&nbsp;@ignore
<a name="line1711"></a><div class="linenumber">1711</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1712"></a><div class="linenumber">1712</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;Session&nbsp;object
<a name="line1713"></a><div class="linenumber">1713</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1714"></a><div class="linenumber">1714</div><div style="width:4em;display:inline-block"></div>connectionObj.getSessionObj&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line1715"></a><div class="linenumber">1715</div><div style="width:6em;display:inline-block"></div>if&nbsp;(e.app[appName].connection[easyrtcid]&nbsp;&amp;&amp;&nbsp;e.app[appName].connection[easyrtcid].toSession&nbsp;&amp;&amp;&nbsp;e.app[appName].connection[easyrtcid].toSession.easyrtcsid)&nbsp;{
<a name="line1716"></a><div class="linenumber">1716</div><div style="width:8em;display:inline-block"></div>appObj.session(e.app[appName].connection[easyrtcid].toSession.easyrtcsid,&nbsp;callback);
<a name="line1717"></a><div class="linenumber">1717</div><div style="width:6em;display:inline-block"></div>}
<a name="line1718"></a><div class="linenumber">1718</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line1719"></a><div class="linenumber">1719</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;null);
<a name="line1720"></a><div class="linenumber">1720</div><div style="width:6em;display:inline-block"></div>}
<a name="line1721"></a><div class="linenumber">1721</div><div style="width:4em;display:inline-block"></div>};
<a name="line1722"></a><div class="linenumber">1722</div><div style="width:0em;display:inline-block"></div>
<a name="line1723"></a><div class="linenumber">1723</div><div style="width:0em;display:inline-block"></div>
<a name="line1724"></a><div class="linenumber">1724</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1725"></a><div class="linenumber">1725</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;username&nbsp;associated&nbsp;with&nbsp;the&nbsp;connection.&nbsp;Returns&nbsp;NULL&nbsp;if&nbsp;no&nbsp;username&nbsp;has&nbsp;been&nbsp;set.
<a name="line1726"></a><div class="linenumber">1726</div><div style="width:4em;display:inline-block"></div>*&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line1727"></a><div class="linenumber">1727</div><div style="width:4em;display:inline-block"></div>*
<a name="line1728"></a><div class="linenumber">1728</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1729"></a><div class="linenumber">1729</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;username&nbsp;associated&nbsp;with&nbsp;the&nbsp;connection.
<a name="line1730"></a><div class="linenumber">1730</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1731"></a><div class="linenumber">1731</div><div style="width:4em;display:inline-block"></div>connectionObj.getUsername&nbsp;=&nbsp;function()&nbsp;{
<a name="line1732"></a><div class="linenumber">1732</div><div style="width:6em;display:inline-block"></div>return&nbsp;e.app[appName].connection[easyrtcid].username;
<a name="line1733"></a><div class="linenumber">1733</div><div style="width:4em;display:inline-block"></div>};
<a name="line1734"></a><div class="linenumber">1734</div><div style="width:0em;display:inline-block"></div>
<a name="line1735"></a><div class="linenumber">1735</div><div style="width:0em;display:inline-block"></div>
<a name="line1736"></a><div class="linenumber">1736</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1737"></a><div class="linenumber">1737</div><div style="width:4em;display:inline-block"></div>*&nbsp;Joins&nbsp;the&nbsp;connection&nbsp;to&nbsp;a&nbsp;specified&nbsp;session.&nbsp;A&nbsp;connection&nbsp;can&nbsp;only&nbsp;be&nbsp;assigned&nbsp;to&nbsp;one&nbsp;session.
<a name="line1738"></a><div class="linenumber">1738</div><div style="width:4em;display:inline-block"></div>*
<a name="line1739"></a><div class="linenumber">1739</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1740"></a><div class="linenumber">1740</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcsid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;session&nbsp;identifier
<a name="line1741"></a><div class="linenumber">1741</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1742"></a><div class="linenumber">1742</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1743"></a><div class="linenumber">1743</div><div style="width:4em;display:inline-block"></div>connectionObj.joinSession&nbsp;=&nbsp;function(easyrtcsid,&nbsp;next)&nbsp;{
<a name="line1744"></a><div class="linenumber">1744</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!e.app[appName].session[easyrtcsid])&nbsp;{
<a name="line1745"></a><div class="linenumber">1745</div><div style="width:8em;display:inline-block"></div>next(new&nbsp;pub.util.ConnectionWarning("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Session&nbsp;["&nbsp;+&nbsp;easyrtcsid&nbsp;+&nbsp;"]&nbsp;does&nbsp;not&nbsp;exist.&nbsp;Could&nbsp;not&nbsp;join&nbsp;session"));
<a name="line1746"></a><div class="linenumber">1746</div><div style="width:8em;display:inline-block"></div>return;
<a name="line1747"></a><div class="linenumber">1747</div><div style="width:6em;display:inline-block"></div>}
<a name="line1748"></a><div class="linenumber">1748</div><div style="width:0em;display:inline-block"></div>
<a name="line1749"></a><div class="linenumber">1749</div><div style="width:6em;display:inline-block"></div>appObj.session(easyrtcsid,&nbsp;function(err,&nbsp;sessionObj)&nbsp;{
<a name="line1750"></a><div class="linenumber">1750</div><div style="width:8em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1751"></a><div class="linenumber">1751</div><div style="width:10em;display:inline-block"></div>next(err);
<a name="line1752"></a><div class="linenumber">1752</div><div style="width:10em;display:inline-block"></div>return;
<a name="line1753"></a><div class="linenumber">1753</div><div style="width:8em;display:inline-block"></div>}
<a name="line1754"></a><div class="linenumber">1754</div><div style="width:0em;display:inline-block"></div>
<a name="line1755"></a><div class="linenumber">1755</div><div style="width:8em;display:inline-block"></div>if(!e.app[appName]&nbsp;||&nbsp;!e.app[appName].connection[easyrtcid]&nbsp;||&nbsp;!e.app[appName].session[easyrtcsid])&nbsp;{
<a name="line1756"></a><div class="linenumber">1756</div><div style="width:10em;display:inline-block"></div>next(new&nbsp;pub.util.ConnectionWarning("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Session&nbsp;["&nbsp;+&nbsp;easyrtcsid&nbsp;+&nbsp;"]&nbsp;does&nbsp;not&nbsp;exist.&nbsp;Could&nbsp;not&nbsp;join&nbsp;session"));
<a name="line1757"></a><div class="linenumber">1757</div><div style="width:10em;display:inline-block"></div>return;
<a name="line1758"></a><div class="linenumber">1758</div><div style="width:8em;display:inline-block"></div>}
<a name="line1759"></a><div class="linenumber">1759</div><div style="width:0em;display:inline-block"></div>
<a name="line1760"></a><div class="linenumber">1760</div><div style="width:8em;display:inline-block"></div>e.app[appName].connection[easyrtcid].toSession&nbsp;=&nbsp;e.app[appName].session[easyrtcsid];
<a name="line1761"></a><div class="linenumber">1761</div><div style="width:8em;display:inline-block"></div>e.app[appName].connection[easyrtcid].toSession.toConnection[easyrtcid]&nbsp;=&nbsp;e.app[appName].connection[easyrtcid];
<a name="line1762"></a><div class="linenumber">1762</div><div style="width:0em;display:inline-block"></div>
<a name="line1763"></a><div class="linenumber">1763</div><div style="width:8em;display:inline-block"></div>//&nbsp;Set&nbsp;local&nbsp;session&nbsp;object
<a name="line1764"></a><div class="linenumber">1764</div><div style="width:8em;display:inline-block"></div>_sessionObj&nbsp;=&nbsp;sessionObj;
<a name="line1765"></a><div class="linenumber">1765</div><div style="width:0em;display:inline-block"></div>
<a name="line1766"></a><div class="linenumber">1766</div><div style="width:8em;display:inline-block"></div>next(null);
<a name="line1767"></a><div class="linenumber">1767</div><div style="width:6em;display:inline-block"></div>});
<a name="line1768"></a><div class="linenumber">1768</div><div style="width:4em;display:inline-block"></div>};
<a name="line1769"></a><div class="linenumber">1769</div><div style="width:0em;display:inline-block"></div>
<a name="line1770"></a><div class="linenumber">1770</div><div style="width:0em;display:inline-block"></div>
<a name="line1771"></a><div class="linenumber">1771</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1772"></a><div class="linenumber">1772</div><div style="width:4em;display:inline-block"></div>*&nbsp;Sets&nbsp;connection&nbsp;authentication&nbsp;status&nbsp;for&nbsp;the&nbsp;connection.
<a name="line1773"></a><div class="linenumber">1773</div><div style="width:4em;display:inline-block"></div>*
<a name="line1774"></a><div class="linenumber">1774</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1775"></a><div class="linenumber">1775</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Boolean}&nbsp;&nbsp;&nbsp;isAuthenticated&nbsp;True/false&nbsp;as&nbsp;to&nbsp;if&nbsp;the&nbsp;connection&nbsp;should&nbsp;be&nbsp;considered&nbsp;authenticated.
<a name="line1776"></a><div class="linenumber">1776</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1777"></a><div class="linenumber">1777</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1778"></a><div class="linenumber">1778</div><div style="width:4em;display:inline-block"></div>connectionObj.setAuthenticated&nbsp;=&nbsp;function(isAuthenticated,&nbsp;next)&nbsp;{
<a name="line1779"></a><div class="linenumber">1779</div><div style="width:6em;display:inline-block"></div>if&nbsp;(isAuthenticated)&nbsp;{
<a name="line1780"></a><div class="linenumber">1780</div><div style="width:8em;display:inline-block"></div>e.app[appName].connection[easyrtcid].isAuthenticated&nbsp;=&nbsp;true;
<a name="line1781"></a><div class="linenumber">1781</div><div style="width:6em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line1782"></a><div class="linenumber">1782</div><div style="width:8em;display:inline-block"></div>e.app[appName].connection[easyrtcid].isAuthenticated&nbsp;=&nbsp;false;
<a name="line1783"></a><div class="linenumber">1783</div><div style="width:6em;display:inline-block"></div>}
<a name="line1784"></a><div class="linenumber">1784</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line1785"></a><div class="linenumber">1785</div><div style="width:4em;display:inline-block"></div>};
<a name="line1786"></a><div class="linenumber">1786</div><div style="width:0em;display:inline-block"></div>
<a name="line1787"></a><div class="linenumber">1787</div><div style="width:0em;display:inline-block"></div>
<a name="line1788"></a><div class="linenumber">1788</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1789"></a><div class="linenumber">1789</div><div style="width:4em;display:inline-block"></div>*&nbsp;Sets&nbsp;the&nbsp;credential&nbsp;for&nbsp;the&nbsp;connection.
<a name="line1790"></a><div class="linenumber">1790</div><div style="width:4em;display:inline-block"></div>*
<a name="line1791"></a><div class="linenumber">1791</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1792"></a><div class="linenumber">1792</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;credential&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Credential&nbsp;for&nbsp;the&nbsp;connection.&nbsp;Can&nbsp;be&nbsp;any&nbsp;JSON&nbsp;object.
<a name="line1793"></a><div class="linenumber">1793</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1794"></a><div class="linenumber">1794</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1795"></a><div class="linenumber">1795</div><div style="width:4em;display:inline-block"></div>connectionObj.setCredential&nbsp;=&nbsp;function(credential,&nbsp;next)&nbsp;{
<a name="line1796"></a><div class="linenumber">1796</div><div style="width:6em;display:inline-block"></div>e.app[appName].connection[easyrtcid].credential&nbsp;=&nbsp;credential;
<a name="line1797"></a><div class="linenumber">1797</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line1798"></a><div class="linenumber">1798</div><div style="width:4em;display:inline-block"></div>};
<a name="line1799"></a><div class="linenumber">1799</div><div style="width:0em;display:inline-block"></div>
<a name="line1800"></a><div class="linenumber">1800</div><div style="width:0em;display:inline-block"></div>
<a name="line1801"></a><div class="linenumber">1801</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1802"></a><div class="linenumber">1802</div><div style="width:4em;display:inline-block"></div>*&nbsp;Sets&nbsp;connection&nbsp;field&nbsp;value&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.
<a name="line1803"></a><div class="linenumber">1803</div><div style="width:4em;display:inline-block"></div>*
<a name="line1804"></a><div class="linenumber">1804</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1805"></a><div class="linenumber">1805</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Must&nbsp;be&nbsp;formatted&nbsp;according&nbsp;to&nbsp;"fieldNameRegExp"&nbsp;option.
<a name="line1806"></a><div class="linenumber">1806</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;fieldValue
<a name="line1807"></a><div class="linenumber">1807</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?Object}&nbsp;&nbsp;&nbsp;fieldOption&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;options&nbsp;(such&nbsp;as&nbsp;isShared&nbsp;which&nbsp;defaults&nbsp;to&nbsp;false)
<a name="line1808"></a><div class="linenumber">1808</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;[next]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).&nbsp;Possible&nbsp;err&nbsp;will&nbsp;be&nbsp;instanceof&nbsp;(ApplicationWarning).
<a name="line1809"></a><div class="linenumber">1809</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1810"></a><div class="linenumber">1810</div><div style="width:4em;display:inline-block"></div>connectionObj.setField&nbsp;=&nbsp;function(fieldName,&nbsp;fieldValue,&nbsp;fieldOption,&nbsp;next)&nbsp;{
<a name="line1811"></a><div class="linenumber">1811</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;-&nbsp;Setting&nbsp;field&nbsp;["&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"]",&nbsp;fieldValue);
<a name="line1812"></a><div class="linenumber">1812</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!_.isFunction(next))&nbsp;{
<a name="line1813"></a><div class="linenumber">1813</div><div style="width:8em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1814"></a><div class="linenumber">1814</div><div style="width:6em;display:inline-block"></div>}
<a name="line1815"></a><div class="linenumber">1815</div><div style="width:0em;display:inline-block"></div>
<a name="line1816"></a><div class="linenumber">1816</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!pub.getOption("fieldNameRegExp").test(fieldName))&nbsp;{
<a name="line1817"></a><div class="linenumber">1817</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;connection&nbsp;field&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'");
<a name="line1818"></a><div class="linenumber">1818</div><div style="width:8em;display:inline-block"></div>next(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;create&nbsp;connection&nbsp;field&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'"));
<a name="line1819"></a><div class="linenumber">1819</div><div style="width:8em;display:inline-block"></div>return;
<a name="line1820"></a><div class="linenumber">1820</div><div style="width:6em;display:inline-block"></div>}
<a name="line1821"></a><div class="linenumber">1821</div><div style="width:0em;display:inline-block"></div>
<a name="line1822"></a><div class="linenumber">1822</div><div style="width:6em;display:inline-block"></div>e.app[appName].connection[easyrtcid].field[fieldName]&nbsp;=&nbsp;{
<a name="line1823"></a><div class="linenumber">1823</div><div style="width:8em;display:inline-block"></div>fieldName:&nbsp;fieldName,
<a name="line1824"></a><div class="linenumber">1824</div><div style="width:8em;display:inline-block"></div>fieldValue:&nbsp;fieldValue,
<a name="line1825"></a><div class="linenumber">1825</div><div style="width:8em;display:inline-block"></div>fieldOption:&nbsp;{isShared:&nbsp;((_.isObject(fieldOption)&nbsp;&amp;&amp;&nbsp;fieldOption.isShared)&nbsp;?&nbsp;true&nbsp;:&nbsp;false)}
<a name="line1826"></a><div class="linenumber">1826</div><div style="width:6em;display:inline-block"></div>};
<a name="line1827"></a><div class="linenumber">1827</div><div style="width:0em;display:inline-block"></div>
<a name="line1828"></a><div class="linenumber">1828</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line1829"></a><div class="linenumber">1829</div><div style="width:4em;display:inline-block"></div>};
<a name="line1830"></a><div class="linenumber">1830</div><div style="width:0em;display:inline-block"></div>
<a name="line1831"></a><div class="linenumber">1831</div><div style="width:0em;display:inline-block"></div>
<a name="line1832"></a><div class="linenumber">1832</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1833"></a><div class="linenumber">1833</div><div style="width:4em;display:inline-block"></div>*&nbsp;Sets&nbsp;the&nbsp;presence&nbsp;object&nbsp;for&nbsp;the&nbsp;connection.
<a name="line1834"></a><div class="linenumber">1834</div><div style="width:4em;display:inline-block"></div>*
<a name="line1835"></a><div class="linenumber">1835</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1836"></a><div class="linenumber">1836</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;presenceObj&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;presence&nbsp;object.
<a name="line1837"></a><div class="linenumber">1837</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1838"></a><div class="linenumber">1838</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1839"></a><div class="linenumber">1839</div><div style="width:4em;display:inline-block"></div>connectionObj.setPresence&nbsp;=&nbsp;function(presenceObj,&nbsp;next)&nbsp;{
<a name="line1840"></a><div class="linenumber">1840</div><div style="width:6em;display:inline-block"></div>if&nbsp;(presenceObj.show&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line1841"></a><div class="linenumber">1841</div><div style="width:8em;display:inline-block"></div>e.app[appName].connection[easyrtcid].presence.show&nbsp;=&nbsp;presenceObj.show;
<a name="line1842"></a><div class="linenumber">1842</div><div style="width:6em;display:inline-block"></div>}
<a name="line1843"></a><div class="linenumber">1843</div><div style="width:6em;display:inline-block"></div>if&nbsp;(presenceObj.status&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line1844"></a><div class="linenumber">1844</div><div style="width:8em;display:inline-block"></div>e.app[appName].connection[easyrtcid].presence.status&nbsp;=&nbsp;presenceObj.status;
<a name="line1845"></a><div class="linenumber">1845</div><div style="width:6em;display:inline-block"></div>}
<a name="line1846"></a><div class="linenumber">1846</div><div style="width:6em;display:inline-block"></div>if&nbsp;(presenceObj.type&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line1847"></a><div class="linenumber">1847</div><div style="width:8em;display:inline-block"></div>e.app[appName].connection[easyrtcid].presence.type&nbsp;=&nbsp;presenceObj.type;
<a name="line1848"></a><div class="linenumber">1848</div><div style="width:6em;display:inline-block"></div>}
<a name="line1849"></a><div class="linenumber">1849</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line1850"></a><div class="linenumber">1850</div><div style="width:4em;display:inline-block"></div>};
<a name="line1851"></a><div class="linenumber">1851</div><div style="width:0em;display:inline-block"></div>
<a name="line1852"></a><div class="linenumber">1852</div><div style="width:0em;display:inline-block"></div>
<a name="line1853"></a><div class="linenumber">1853</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1854"></a><div class="linenumber">1854</div><div style="width:4em;display:inline-block"></div>*&nbsp;Sets&nbsp;the&nbsp;username&nbsp;string&nbsp;for&nbsp;the&nbsp;connection.
<a name="line1855"></a><div class="linenumber">1855</div><div style="width:4em;display:inline-block"></div>*
<a name="line1856"></a><div class="linenumber">1856</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1857"></a><div class="linenumber">1857</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?string}&nbsp;&nbsp;&nbsp;username&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Username&nbsp;to&nbsp;assign&nbsp;to&nbsp;the&nbsp;connection.
<a name="line1858"></a><div class="linenumber">1858</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1859"></a><div class="linenumber">1859</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1860"></a><div class="linenumber">1860</div><div style="width:4em;display:inline-block"></div>connectionObj.setUsername&nbsp;=&nbsp;function(username,&nbsp;next)&nbsp;{
<a name="line1861"></a><div class="linenumber">1861</div><div style="width:6em;display:inline-block"></div>e.app[appName].connection[easyrtcid].username&nbsp;=&nbsp;username;
<a name="line1862"></a><div class="linenumber">1862</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line1863"></a><div class="linenumber">1863</div><div style="width:4em;display:inline-block"></div>};
<a name="line1864"></a><div class="linenumber">1864</div><div style="width:0em;display:inline-block"></div>
<a name="line1865"></a><div class="linenumber">1865</div><div style="width:0em;display:inline-block"></div>
<a name="line1866"></a><div class="linenumber">1866</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1867"></a><div class="linenumber">1867</div><div style="width:4em;display:inline-block"></div>*&nbsp;Emits&nbsp;the&nbsp;roomData&nbsp;message&nbsp;with&nbsp;a&nbsp;clientListDelta&nbsp;for&nbsp;the&nbsp;current&nbsp;connection&nbsp;to&nbsp;other&nbsp;connections&nbsp;in&nbsp;rooms&nbsp;this&nbsp;connection&nbsp;is&nbsp;in.
<a name="line1868"></a><div class="linenumber">1868</div><div style="width:4em;display:inline-block"></div>*&nbsp;Note:&nbsp;To&nbsp;send&nbsp;listDeltas&nbsp;for&nbsp;individual&nbsp;rooms,&nbsp;use&nbsp;connectionRoomObj.emitRoomDataDelta
<a name="line1869"></a><div class="linenumber">1869</div><div style="width:4em;display:inline-block"></div>*
<a name="line1870"></a><div class="linenumber">1870</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1871"></a><div class="linenumber">1871</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Boolean}&nbsp;&nbsp;&nbsp;isLeavingAllRooms&nbsp;&nbsp;&nbsp;Indicator&nbsp;if&nbsp;connection&nbsp;is&nbsp;leaving&nbsp;all&nbsp;rooms.&nbsp;Meant&nbsp;to&nbsp;be&nbsp;used&nbsp;upon&nbsp;disconnection&nbsp;/&nbsp;logoff.
<a name="line1872"></a><div class="linenumber">1872</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;of&nbsp;form&nbsp;(err,&nbsp;roomDataObj)&nbsp;which&nbsp;will&nbsp;contain&nbsp;the&nbsp;roomDataObj&nbsp;including&nbsp;all&nbsp;updated&nbsp;rooms&nbsp;of&nbsp;the&nbsp;connection&nbsp;and&nbsp;is&nbsp;designed&nbsp;to&nbsp;be&nbsp;returnable&nbsp;to&nbsp;the&nbsp;connection.
<a name="line1873"></a><div class="linenumber">1873</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1874"></a><div class="linenumber">1874</div><div style="width:4em;display:inline-block"></div>connectionObj.emitRoomDataDelta&nbsp;=&nbsp;function(isLeavingAllRooms,&nbsp;callback)&nbsp;{
<a name="line1875"></a><div class="linenumber">1875</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Running&nbsp;func&nbsp;'connectionObj.emitRoomDataDelta'");
<a name="line1876"></a><div class="linenumber">1876</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!_.isFunction(callback))&nbsp;{
<a name="line1877"></a><div class="linenumber">1877</div><div style="width:8em;display:inline-block"></div>callback&nbsp;=&nbsp;function(err,&nbsp;roomDataObj)&nbsp;{
<a name="line1878"></a><div class="linenumber">1878</div><div style="width:8em;display:inline-block"></div>};
<a name="line1879"></a><div class="linenumber">1879</div><div style="width:6em;display:inline-block"></div>}
<a name="line1880"></a><div class="linenumber">1880</div><div style="width:0em;display:inline-block"></div>
<a name="line1881"></a><div class="linenumber">1881</div><div style="width:6em;display:inline-block"></div>var&nbsp;fullRoomDataDelta&nbsp;=&nbsp;{};
<a name="line1882"></a><div class="linenumber">1882</div><div style="width:0em;display:inline-block"></div>
<a name="line1883"></a><div class="linenumber">1883</div><div style="width:6em;display:inline-block"></div>var&nbsp;otherClients&nbsp;=&nbsp;{};
<a name="line1884"></a><div class="linenumber">1884</div><div style="width:0em;display:inline-block"></div>
<a name="line1885"></a><div class="linenumber">1885</div><div style="width:6em;display:inline-block"></div>//&nbsp;Generate&nbsp;a&nbsp;complete&nbsp;roomDelta&nbsp;for&nbsp;the&nbsp;current&nbsp;client
<a name="line1886"></a><div class="linenumber">1886</div><div style="width:6em;display:inline-block"></div>connectionObj.generateRoomDataDelta(isLeavingAllRooms,&nbsp;function(err,&nbsp;newFullRoomDataDelta)&nbsp;{
<a name="line1887"></a><div class="linenumber">1887</div><div style="width:8em;display:inline-block"></div>fullRoomDataDelta&nbsp;=&nbsp;newFullRoomDataDelta;
<a name="line1888"></a><div class="linenumber">1888</div><div style="width:0em;display:inline-block"></div>
<a name="line1889"></a><div class="linenumber">1889</div><div style="width:8em;display:inline-block"></div>//&nbsp;Running&nbsp;callback&nbsp;right&nbsp;away&nbsp;so&nbsp;client&nbsp;doesn't&nbsp;have&nbsp;to&nbsp;wait&nbsp;to&nbsp;continue
<a name="line1890"></a><div class="linenumber">1890</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;fullRoomDataDelta);
<a name="line1891"></a><div class="linenumber">1891</div><div style="width:0em;display:inline-block"></div>
<a name="line1892"></a><div class="linenumber">1892</div><div style="width:8em;display:inline-block"></div>//&nbsp;Populate&nbsp;otherClients&nbsp;object&nbsp;with&nbsp;other&nbsp;clients&nbsp;who&nbsp;share&nbsp;room(s)
<a name="line1893"></a><div class="linenumber">1893</div><div style="width:8em;display:inline-block"></div>for&nbsp;(var&nbsp;currentRoomName&nbsp;in&nbsp;fullRoomDataDelta)&nbsp;{
<a name="line1894"></a><div class="linenumber">1894</div><div style="width:10em;display:inline-block"></div>for&nbsp;(var&nbsp;currentEasyrtcid&nbsp;in&nbsp;e.app[appName].room[currentRoomName].clientList)&nbsp;{
<a name="line1895"></a><div class="linenumber">1895</div><div style="width:12em;display:inline-block"></div>if&nbsp;(otherClients[currentEasyrtcid]&nbsp;===&nbsp;undefined)&nbsp;{
<a name="line1896"></a><div class="linenumber">1896</div><div style="width:14em;display:inline-block"></div>otherClients[currentEasyrtcid]&nbsp;=&nbsp;{};
<a name="line1897"></a><div class="linenumber">1897</div><div style="width:12em;display:inline-block"></div>}
<a name="line1898"></a><div class="linenumber">1898</div><div style="width:12em;display:inline-block"></div>otherClients[currentEasyrtcid][currentRoomName]&nbsp;=&nbsp;true;
<a name="line1899"></a><div class="linenumber">1899</div><div style="width:10em;display:inline-block"></div>}
<a name="line1900"></a><div class="linenumber">1900</div><div style="width:8em;display:inline-block"></div>}
<a name="line1901"></a><div class="linenumber">1901</div><div style="width:0em;display:inline-block"></div>
<a name="line1902"></a><div class="linenumber">1902</div><div style="width:8em;display:inline-block"></div>//&nbsp;Emit&nbsp;custom&nbsp;roomData&nbsp;object&nbsp;to&nbsp;each&nbsp;client&nbsp;who&nbsp;shares&nbsp;a&nbsp;room&nbsp;with&nbsp;the&nbsp;current&nbsp;client
<a name="line1903"></a><div class="linenumber">1903</div><div style="width:8em;display:inline-block"></div>for&nbsp;(var&nbsp;currentEasyrtcid&nbsp;in&nbsp;otherClients)&nbsp;{
<a name="line1904"></a><div class="linenumber">1904</div><div style="width:10em;display:inline-block"></div>var&nbsp;msg&nbsp;=&nbsp;{
<a name="line1905"></a><div class="linenumber">1905</div><div style="width:12em;display:inline-block"></div>"msgData":&nbsp;{
<a name="line1906"></a><div class="linenumber">1906</div><div style="width:14em;display:inline-block"></div>"roomData":&nbsp;{}
<a name="line1907"></a><div class="linenumber">1907</div><div style="width:12em;display:inline-block"></div>}
<a name="line1908"></a><div class="linenumber">1908</div><div style="width:10em;display:inline-block"></div>};
<a name="line1909"></a><div class="linenumber">1909</div><div style="width:0em;display:inline-block"></div>
<a name="line1910"></a><div class="linenumber">1910</div><div style="width:10em;display:inline-block"></div>for&nbsp;(var&nbsp;currentRoomName&nbsp;in&nbsp;otherClients[currentEasyrtcid])&nbsp;{
<a name="line1911"></a><div class="linenumber">1911</div><div style="width:12em;display:inline-block"></div>if&nbsp;(fullRoomDataDelta[currentRoomName])&nbsp;{
<a name="line1912"></a><div class="linenumber">1912</div><div style="width:14em;display:inline-block"></div>msg.msgData.roomData[currentRoomName]&nbsp;=&nbsp;fullRoomDataDelta[currentRoomName];
<a name="line1913"></a><div class="linenumber">1913</div><div style="width:12em;display:inline-block"></div>}
<a name="line1914"></a><div class="linenumber">1914</div><div style="width:10em;display:inline-block"></div>}
<a name="line1915"></a><div class="linenumber">1915</div><div style="width:0em;display:inline-block"></div>
<a name="line1916"></a><div class="linenumber">1916</div><div style="width:10em;display:inline-block"></div>//&nbsp;Anonymous&nbsp;wrapper&nbsp;to&nbsp;deliver&nbsp;arguments
<a name="line1917"></a><div class="linenumber">1917</div><div style="width:10em;display:inline-block"></div>(function(innerCurrentEasyrtcid,&nbsp;innerMsg){
<a name="line1918"></a><div class="linenumber">1918</div><div style="width:12em;display:inline-block"></div>connectionObj.getApp().connection(innerCurrentEasyrtcid,&nbsp;function(err,&nbsp;emitToConnectionObj)&nbsp;{
<a name="line1919"></a><div class="linenumber">1919</div><div style="width:14em;display:inline-block"></div>if&nbsp;(!err&nbsp;&amp;&amp;&nbsp;innerCurrentEasyrtcid&nbsp;!=&nbsp;easyrtcid&nbsp;&amp;&amp;&nbsp;emitToConnectionObj)&nbsp;{
<a name="line1920"></a><div class="linenumber">1920</div><div style="width:16em;display:inline-block"></div>pub.events.emit("emitEasyrtcCmd",&nbsp;emitToConnectionObj,&nbsp;"roomData",&nbsp;innerMsg,&nbsp;null,&nbsp;function()&nbsp;{});
<a name="line1921"></a><div class="linenumber">1921</div><div style="width:14em;display:inline-block"></div>}
<a name="line1922"></a><div class="linenumber">1922</div><div style="width:12em;display:inline-block"></div>});
<a name="line1923"></a><div class="linenumber">1923</div><div style="width:10em;display:inline-block"></div>})(currentEasyrtcid,&nbsp;msg);
<a name="line1924"></a><div class="linenumber">1924</div><div style="width:8em;display:inline-block"></div>}
<a name="line1925"></a><div class="linenumber">1925</div><div style="width:6em;display:inline-block"></div>});
<a name="line1926"></a><div class="linenumber">1926</div><div style="width:4em;display:inline-block"></div>};
<a name="line1927"></a><div class="linenumber">1927</div><div style="width:0em;display:inline-block"></div>
<a name="line1928"></a><div class="linenumber">1928</div><div style="width:0em;display:inline-block"></div>
<a name="line1929"></a><div class="linenumber">1929</div><div style="width:4em;display:inline-block"></div>/**
<a name="line1930"></a><div class="linenumber">1930</div><div style="width:4em;display:inline-block"></div>*&nbsp;Generates&nbsp;a&nbsp;full&nbsp;room&nbsp;clientList&nbsp;object&nbsp;for&nbsp;the&nbsp;given&nbsp;connection
<a name="line1931"></a><div class="linenumber">1931</div><div style="width:4em;display:inline-block"></div>*
<a name="line1932"></a><div class="linenumber">1932</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line1933"></a><div class="linenumber">1933</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?string}&nbsp;&nbsp;&nbsp;[roomStatus="join"]&nbsp;Room&nbsp;status&nbsp;which&nbsp;allow&nbsp;for&nbsp;values&nbsp;of&nbsp;"join"|"update"|"leave".
<a name="line1934"></a><div class="linenumber">1934</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?Object}&nbsp;&nbsp;&nbsp;roomMap&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map&nbsp;of&nbsp;rooms&nbsp;to&nbsp;generate&nbsp;connection&nbsp;clientList&nbsp;for.&nbsp;If&nbsp;null,&nbsp;then&nbsp;all&nbsp;rooms&nbsp;will&nbsp;be&nbsp;used.
<a name="line1935"></a><div class="linenumber">1935</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;&nbsp;&nbsp;&nbsp;Callback&nbsp;which&nbsp;includes&nbsp;a&nbsp;formed&nbsp;roomData&nbsp;object&nbsp;.
<a name="line1936"></a><div class="linenumber">1936</div><div style="width:4em;display:inline-block"></div>*/
<a name="line1937"></a><div class="linenumber">1937</div><div style="width:4em;display:inline-block"></div>connectionObj.generateRoomClientList&nbsp;=&nbsp;function(roomStatus,&nbsp;roomMap,&nbsp;callback)&nbsp;{
<a name="line1938"></a><div class="linenumber">1938</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!_.isString(roomStatus))&nbsp;{
<a name="line1939"></a><div class="linenumber">1939</div><div style="width:8em;display:inline-block"></div>roomStatus&nbsp;=&nbsp;"join";
<a name="line1940"></a><div class="linenumber">1940</div><div style="width:6em;display:inline-block"></div>}
<a name="line1941"></a><div class="linenumber">1941</div><div style="width:0em;display:inline-block"></div>
<a name="line1942"></a><div class="linenumber">1942</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!_.isObject(roomMap))&nbsp;{
<a name="line1943"></a><div class="linenumber">1943</div><div style="width:8em;display:inline-block"></div>roomMap&nbsp;=&nbsp;e.app[appName].connection[easyrtcid].room;
<a name="line1944"></a><div class="linenumber">1944</div><div style="width:6em;display:inline-block"></div>}
<a name="line1945"></a><div class="linenumber">1945</div><div style="width:0em;display:inline-block"></div>
<a name="line1946"></a><div class="linenumber">1946</div><div style="width:6em;display:inline-block"></div>var&nbsp;roomData&nbsp;=&nbsp;{};
<a name="line1947"></a><div class="linenumber">1947</div><div style="width:0em;display:inline-block"></div>
<a name="line1948"></a><div class="linenumber">1948</div><div style="width:6em;display:inline-block"></div>for&nbsp;(var&nbsp;currentRoomName&nbsp;in&nbsp;e.app[appName].connection[easyrtcid].room)&nbsp;{
<a name="line1949"></a><div class="linenumber">1949</div><div style="width:8em;display:inline-block"></div>//&nbsp;If&nbsp;room&nbsp;is&nbsp;not&nbsp;in&nbsp;the&nbsp;provided&nbsp;roomMap,&nbsp;then&nbsp;skip&nbsp;it.
<a name="line1950"></a><div class="linenumber">1950</div><div style="width:8em;display:inline-block"></div>if&nbsp;(!roomMap[currentRoomName])&nbsp;{
<a name="line1951"></a><div class="linenumber">1951</div><div style="width:10em;display:inline-block"></div>continue;
<a name="line1952"></a><div class="linenumber">1952</div><div style="width:8em;display:inline-block"></div>}
<a name="line1953"></a><div class="linenumber">1953</div><div style="width:0em;display:inline-block"></div>
<a name="line1954"></a><div class="linenumber">1954</div><div style="width:8em;display:inline-block"></div>var&nbsp;connectionRoom&nbsp;=&nbsp;e.app[appName].connection[easyrtcid].room[currentRoomName];
<a name="line1955"></a><div class="linenumber">1955</div><div style="width:8em;display:inline-block"></div>roomData[currentRoomName]&nbsp;=&nbsp;{
<a name="line1956"></a><div class="linenumber">1956</div><div style="width:10em;display:inline-block"></div>"roomName":&nbsp;currentRoomName,
<a name="line1957"></a><div class="linenumber">1957</div><div style="width:10em;display:inline-block"></div>"roomStatus":&nbsp;roomStatus,
<a name="line1958"></a><div class="linenumber">1958</div><div style="width:10em;display:inline-block"></div>"clientList":&nbsp;{}
<a name="line1959"></a><div class="linenumber">1959</div><div style="width:8em;display:inline-block"></div>};
<a name="line1960"></a><div class="linenumber">1960</div><div style="width:0em;display:inline-block"></div>
<a name="line1961"></a><div class="linenumber">1961</div><div style="width:8em;display:inline-block"></div>//&nbsp;Empty&nbsp;current&nbsp;clientList
<a name="line1962"></a><div class="linenumber">1962</div><div style="width:8em;display:inline-block"></div>connectionRoom.clientList&nbsp;=&nbsp;{};
<a name="line1963"></a><div class="linenumber">1963</div><div style="width:0em;display:inline-block"></div>
<a name="line1964"></a><div class="linenumber">1964</div><div style="width:8em;display:inline-block"></div>//&nbsp;Fill&nbsp;connection&nbsp;clientList,&nbsp;and&nbsp;roomData&nbsp;clientList&nbsp;for&nbsp;current&nbsp;room
<a name="line1965"></a><div class="linenumber">1965</div><div style="width:8em;display:inline-block"></div>for&nbsp;(var&nbsp;currentEasyrtcid&nbsp;in&nbsp;connectionRoom.toRoom.clientList)&nbsp;{
<a name="line1966"></a><div class="linenumber">1966</div><div style="width:0em;display:inline-block"></div>
<a name="line1967"></a><div class="linenumber">1967</div><div style="width:10em;display:inline-block"></div>var&nbsp;currentToConnection&nbsp;=&nbsp;connectionRoom.toRoom.clientList[currentEasyrtcid].toConnection;
<a name="line1968"></a><div class="linenumber">1968</div><div style="width:0em;display:inline-block"></div>
<a name="line1969"></a><div class="linenumber">1969</div><div style="width:10em;display:inline-block"></div>connectionRoom.clientList[currentEasyrtcid]&nbsp;=&nbsp;{
<a name="line1970"></a><div class="linenumber">1970</div><div style="width:12em;display:inline-block"></div>"toConnection":&nbsp;currentToConnection
<a name="line1971"></a><div class="linenumber">1971</div><div style="width:10em;display:inline-block"></div>};
<a name="line1972"></a><div class="linenumber">1972</div><div style="width:0em;display:inline-block"></div>
<a name="line1973"></a><div class="linenumber">1973</div><div style="width:10em;display:inline-block"></div>roomData[currentRoomName].clientList[currentEasyrtcid]&nbsp;=&nbsp;{
<a name="line1974"></a><div class="linenumber">1974</div><div style="width:12em;display:inline-block"></div>"easyrtcid":&nbsp;currentEasyrtcid,
<a name="line1975"></a><div class="linenumber">1975</div><div style="width:12em;display:inline-block"></div>"roomJoinTime":&nbsp;currentToConnection.room[currentRoomName].enteredOn,
<a name="line1976"></a><div class="linenumber">1976</div><div style="width:12em;display:inline-block"></div>"presence":&nbsp;currentToConnection.presence
<a name="line1977"></a><div class="linenumber">1977</div><div style="width:10em;display:inline-block"></div>};
<a name="line1978"></a><div class="linenumber">1978</div><div style="width:0em;display:inline-block"></div>
<a name="line1979"></a><div class="linenumber">1979</div><div style="width:10em;display:inline-block"></div>if&nbsp;(currentToConnection.room[currentRoomName]&nbsp;&amp;&amp;&nbsp;(!_.isEmpty(currentToConnection.room[currentRoomName].apiField)))&nbsp;{
<a name="line1980"></a><div class="linenumber">1980</div><div style="width:12em;display:inline-block"></div>roomData[currentRoomName].clientList[currentEasyrtcid].apiField&nbsp;=&nbsp;currentToConnection.room[currentRoomName].apiField;
<a name="line1981"></a><div class="linenumber">1981</div><div style="width:10em;display:inline-block"></div>}
<a name="line1982"></a><div class="linenumber">1982</div><div style="width:0em;display:inline-block"></div>
<a name="line1983"></a><div class="linenumber">1983</div><div style="width:10em;display:inline-block"></div>if&nbsp;(currentToConnection.username)&nbsp;{
<a name="line1984"></a><div class="linenumber">1984</div><div style="width:12em;display:inline-block"></div>roomData[currentRoomName].clientList[currentEasyrtcid].username&nbsp;=&nbsp;currentToConnection.username;
<a name="line1985"></a><div class="linenumber">1985</div><div style="width:10em;display:inline-block"></div>}
<a name="line1986"></a><div class="linenumber">1986</div><div style="width:8em;display:inline-block"></div>}
<a name="line1987"></a><div class="linenumber">1987</div><div style="width:0em;display:inline-block"></div>
<a name="line1988"></a><div class="linenumber">1988</div><div style="width:8em;display:inline-block"></div>//&nbsp;Include&nbsp;room&nbsp;fields&nbsp;(with&nbsp;isShared&nbsp;set&nbsp;to&nbsp;true)
<a name="line1989"></a><div class="linenumber">1989</div><div style="width:8em;display:inline-block"></div>for&nbsp;(var&nbsp;fieldName&nbsp;in&nbsp;connectionRoom.toRoom.field)&nbsp;{
<a name="line1990"></a><div class="linenumber">1990</div><div style="width:10em;display:inline-block"></div>if&nbsp;(_.isObject(connectionRoom.toRoom.field[fieldName].fieldOption)&nbsp;&amp;&amp;&nbsp;connectionRoom.toRoom.field[fieldName].fieldOption.isShared)&nbsp;{
<a name="line1991"></a><div class="linenumber">1991</div><div style="width:12em;display:inline-block"></div>if&nbsp;(!_.isObject(roomData[currentRoomName].field))&nbsp;{
<a name="line1992"></a><div class="linenumber">1992</div><div style="width:14em;display:inline-block"></div>roomData[currentRoomName].field&nbsp;=&nbsp;{};
<a name="line1993"></a><div class="linenumber">1993</div><div style="width:12em;display:inline-block"></div>}
<a name="line1994"></a><div class="linenumber">1994</div><div style="width:12em;display:inline-block"></div>roomData[currentRoomName].field[fieldName]&nbsp;=&nbsp;{
<a name="line1995"></a><div class="linenumber">1995</div><div style="width:14em;display:inline-block"></div>"fieldName":&nbsp;fieldName,
<a name="line1996"></a><div class="linenumber">1996</div><div style="width:14em;display:inline-block"></div>"fieldValue":&nbsp;pub.util.deepCopy(connectionRoom.toRoom.field[fieldName].fieldValue)
<a name="line1997"></a><div class="linenumber">1997</div><div style="width:12em;display:inline-block"></div>};
<a name="line1998"></a><div class="linenumber">1998</div><div style="width:10em;display:inline-block"></div>}
<a name="line1999"></a><div class="linenumber">1999</div><div style="width:8em;display:inline-block"></div>}
<a name="line2000"></a><div class="linenumber">2000</div><div style="width:0em;display:inline-block"></div>
<a name="line2001"></a><div class="linenumber">2001</div><div style="width:8em;display:inline-block"></div>//&nbsp;Updating&nbsp;timestamp&nbsp;of&nbsp;when&nbsp;clientList&nbsp;was&nbsp;retrieved.&nbsp;Useful&nbsp;for&nbsp;sending&nbsp;delta's&nbsp;later&nbsp;on.
<a name="line2002"></a><div class="linenumber">2002</div><div style="width:8em;display:inline-block"></div>connectionRoom.gotListOn&nbsp;=&nbsp;Date.now();
<a name="line2003"></a><div class="linenumber">2003</div><div style="width:6em;display:inline-block"></div>}
<a name="line2004"></a><div class="linenumber">2004</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;roomData);
<a name="line2005"></a><div class="linenumber">2005</div><div style="width:4em;display:inline-block"></div>};
<a name="line2006"></a><div class="linenumber">2006</div><div style="width:0em;display:inline-block"></div>
<a name="line2007"></a><div class="linenumber">2007</div><div style="width:0em;display:inline-block"></div>
<a name="line2008"></a><div class="linenumber">2008</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2009"></a><div class="linenumber">2009</div><div style="width:4em;display:inline-block"></div>*&nbsp;Generates&nbsp;a&nbsp;delta&nbsp;roomData&nbsp;object&nbsp;for&nbsp;the&nbsp;current&nbsp;user&nbsp;including&nbsp;all&nbsp;rooms&nbsp;the&nbsp;user&nbsp;is&nbsp;in.&nbsp;The&nbsp;result&nbsp;can&nbsp;be&nbsp;selectively&nbsp;parsed&nbsp;to&nbsp;deliver&nbsp;delta&nbsp;roomData&nbsp;objects&nbsp;to&nbsp;other&nbsp;clients.
<a name="line2010"></a><div class="linenumber">2010</div><div style="width:4em;display:inline-block"></div>*
<a name="line2011"></a><div class="linenumber">2011</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line2012"></a><div class="linenumber">2012</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Boolean}&nbsp;&nbsp;&nbsp;isLeavingRoom&nbsp;&nbsp;&nbsp;Indicates&nbsp;if&nbsp;connection&nbsp;is&nbsp;in&nbsp;the&nbsp;process&nbsp;of&nbsp;leaving&nbsp;the&nbsp;room.
<a name="line2013"></a><div class="linenumber">2013</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;of&nbsp;form&nbsp;(err,&nbsp;roomDataDelta).
<a name="line2014"></a><div class="linenumber">2014</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2015"></a><div class="linenumber">2015</div><div style="width:4em;display:inline-block"></div>connectionObj.generateRoomDataDelta&nbsp;=&nbsp;function(isLeavingRoom,&nbsp;callback)&nbsp;{
<a name="line2016"></a><div class="linenumber">2016</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Running&nbsp;func&nbsp;'connectionObj.generateRoomDataDelta'");
<a name="line2017"></a><div class="linenumber">2017</div><div style="width:0em;display:inline-block"></div>
<a name="line2018"></a><div class="linenumber">2018</div><div style="width:6em;display:inline-block"></div>var&nbsp;roomDataDelta&nbsp;=&nbsp;{};
<a name="line2019"></a><div class="linenumber">2019</div><div style="width:0em;display:inline-block"></div>
<a name="line2020"></a><div class="linenumber">2020</div><div style="width:6em;display:inline-block"></div>//&nbsp;set&nbsp;the&nbsp;roomData's&nbsp;clientListDelta&nbsp;for&nbsp;each&nbsp;room&nbsp;the&nbsp;client&nbsp;is&nbsp;in
<a name="line2021"></a><div class="linenumber">2021</div><div style="width:6em;display:inline-block"></div>for&nbsp;(var&nbsp;currentRoomName&nbsp;in&nbsp;e.app[appName].connection[easyrtcid].room)&nbsp;{
<a name="line2022"></a><div class="linenumber">2022</div><div style="width:8em;display:inline-block"></div>roomDataDelta[currentRoomName]&nbsp;=&nbsp;{
<a name="line2023"></a><div class="linenumber">2023</div><div style="width:10em;display:inline-block"></div>"roomName":&nbsp;currentRoomName,
<a name="line2024"></a><div class="linenumber">2024</div><div style="width:10em;display:inline-block"></div>"roomStatus":&nbsp;"update",
<a name="line2025"></a><div class="linenumber">2025</div><div style="width:10em;display:inline-block"></div>"clientListDelta":&nbsp;{}
<a name="line2026"></a><div class="linenumber">2026</div><div style="width:8em;display:inline-block"></div>};
<a name="line2027"></a><div class="linenumber">2027</div><div style="width:0em;display:inline-block"></div>
<a name="line2028"></a><div class="linenumber">2028</div><div style="width:8em;display:inline-block"></div>if&nbsp;(isLeavingRoom)&nbsp;{
<a name="line2029"></a><div class="linenumber">2029</div><div style="width:10em;display:inline-block"></div>roomDataDelta[currentRoomName].clientListDelta.removeClient&nbsp;=&nbsp;{};
<a name="line2030"></a><div class="linenumber">2030</div><div style="width:10em;display:inline-block"></div>roomDataDelta[currentRoomName].clientListDelta.removeClient[easyrtcid]&nbsp;=&nbsp;{"easyrtcid":&nbsp;easyrtcid};
<a name="line2031"></a><div class="linenumber">2031</div><div style="width:8em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line2032"></a><div class="linenumber">2032</div><div style="width:10em;display:inline-block"></div>roomDataDelta[currentRoomName].clientListDelta.updateClient&nbsp;=&nbsp;{};
<a name="line2033"></a><div class="linenumber">2033</div><div style="width:10em;display:inline-block"></div>roomDataDelta[currentRoomName].clientListDelta.updateClient[easyrtcid]&nbsp;=&nbsp;{
<a name="line2034"></a><div class="linenumber">2034</div><div style="width:12em;display:inline-block"></div>"easyrtcid":&nbsp;easyrtcid,
<a name="line2035"></a><div class="linenumber">2035</div><div style="width:12em;display:inline-block"></div>"roomJoinTime":&nbsp;e.app[appName].connection[easyrtcid].room[currentRoomName].enteredOn,
<a name="line2036"></a><div class="linenumber">2036</div><div style="width:12em;display:inline-block"></div>"presence":&nbsp;e.app[appName].connection[easyrtcid].presence
<a name="line2037"></a><div class="linenumber">2037</div><div style="width:10em;display:inline-block"></div>};
<a name="line2038"></a><div class="linenumber">2038</div><div style="width:0em;display:inline-block"></div>
<a name="line2039"></a><div class="linenumber">2039</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isEmpty(e.app[appName].connection[easyrtcid].apiField))&nbsp;{
<a name="line2040"></a><div class="linenumber">2040</div><div style="width:12em;display:inline-block"></div>roomDataDelta[currentRoomName].clientListDelta.updateClient[easyrtcid].apiField&nbsp;=&nbsp;e.app[appName].connection[easyrtcid].apiField;
<a name="line2041"></a><div class="linenumber">2041</div><div style="width:10em;display:inline-block"></div>}
<a name="line2042"></a><div class="linenumber">2042</div><div style="width:10em;display:inline-block"></div>if&nbsp;(e.app[appName].connection[easyrtcid].username)&nbsp;{
<a name="line2043"></a><div class="linenumber">2043</div><div style="width:12em;display:inline-block"></div>roomDataDelta[currentRoomName].clientListDelta.updateClient[easyrtcid].username&nbsp;=&nbsp;e.app[appName].connection[easyrtcid].username;
<a name="line2044"></a><div class="linenumber">2044</div><div style="width:10em;display:inline-block"></div>}
<a name="line2045"></a><div class="linenumber">2045</div><div style="width:8em;display:inline-block"></div>}
<a name="line2046"></a><div class="linenumber">2046</div><div style="width:6em;display:inline-block"></div>}
<a name="line2047"></a><div class="linenumber">2047</div><div style="width:0em;display:inline-block"></div>
<a name="line2048"></a><div class="linenumber">2048</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;roomDataDelta);
<a name="line2049"></a><div class="linenumber">2049</div><div style="width:4em;display:inline-block"></div>};
<a name="line2050"></a><div class="linenumber">2050</div><div style="width:0em;display:inline-block"></div>
<a name="line2051"></a><div class="linenumber">2051</div><div style="width:0em;display:inline-block"></div>
<a name="line2052"></a><div class="linenumber">2052</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2053"></a><div class="linenumber">2053</div><div style="width:4em;display:inline-block"></div>*&nbsp;Generates&nbsp;the&nbsp;roomList&nbsp;message&nbsp;object
<a name="line2054"></a><div class="linenumber">2054</div><div style="width:4em;display:inline-block"></div>*
<a name="line2055"></a><div class="linenumber">2055</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line2056"></a><div class="linenumber">2056</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;roomList&nbsp;object.
<a name="line2057"></a><div class="linenumber">2057</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2058"></a><div class="linenumber">2058</div><div style="width:4em;display:inline-block"></div>connectionObj.generateRoomList&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line2059"></a><div class="linenumber">2059</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Running&nbsp;func&nbsp;'connectionObj.generateRoomList'");
<a name="line2060"></a><div class="linenumber">2060</div><div style="width:6em;display:inline-block"></div>var&nbsp;roomList&nbsp;=&nbsp;{};
<a name="line2061"></a><div class="linenumber">2061</div><div style="width:0em;display:inline-block"></div>
<a name="line2062"></a><div class="linenumber">2062</div><div style="width:6em;display:inline-block"></div>for&nbsp;(var&nbsp;currentRoomName&nbsp;in&nbsp;e.app[appName].room)&nbsp;{
<a name="line2063"></a><div class="linenumber">2063</div><div style="width:8em;display:inline-block"></div>roomList[currentRoomName]&nbsp;=&nbsp;{
<a name="line2064"></a><div class="linenumber">2064</div><div style="width:10em;display:inline-block"></div>"roomName":&nbsp;currentRoomName,
<a name="line2065"></a><div class="linenumber">2065</div><div style="width:10em;display:inline-block"></div>"numberClients":&nbsp;_.size(e.app[appName].room[currentRoomName].clientList)
<a name="line2066"></a><div class="linenumber">2066</div><div style="width:8em;display:inline-block"></div>};
<a name="line2067"></a><div class="linenumber">2067</div><div style="width:6em;display:inline-block"></div>}
<a name="line2068"></a><div class="linenumber">2068</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;roomList);
<a name="line2069"></a><div class="linenumber">2069</div><div style="width:4em;display:inline-block"></div>};
<a name="line2070"></a><div class="linenumber">2070</div><div style="width:0em;display:inline-block"></div>
<a name="line2071"></a><div class="linenumber">2071</div><div style="width:0em;display:inline-block"></div>
<a name="line2072"></a><div class="linenumber">2072</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2073"></a><div class="linenumber">2073</div><div style="width:4em;display:inline-block"></div>*&nbsp;Gets&nbsp;connection&nbsp;authentication&nbsp;status&nbsp;for&nbsp;the&nbsp;connection.&nbsp;It&nbsp;is&nbsp;possible&nbsp;for&nbsp;a&nbsp;connection&nbsp;to&nbsp;become&nbsp;disconnected&nbsp;and&nbsp;keep&nbsp;the&nbsp;authenticated&nbsp;flag.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line2074"></a><div class="linenumber">2074</div><div style="width:4em;display:inline-block"></div>*
<a name="line2075"></a><div class="linenumber">2075</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line2076"></a><div class="linenumber">2076</div><div style="width:4em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Boolean}&nbsp;&nbsp;&nbsp;Authentication&nbsp;status
<a name="line2077"></a><div class="linenumber">2077</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2078"></a><div class="linenumber">2078</div><div style="width:4em;display:inline-block"></div>connectionObj.isAuthenticated&nbsp;=&nbsp;function()&nbsp;{
<a name="line2079"></a><div class="linenumber">2079</div><div style="width:6em;display:inline-block"></div>if&nbsp;(e.app[appName].connection[easyrtcid]&nbsp;&amp;&amp;&nbsp;e.app[appName].connection[easyrtcid].isAuthenticated)&nbsp;{
<a name="line2080"></a><div class="linenumber">2080</div><div style="width:8em;display:inline-block"></div>return&nbsp;true;
<a name="line2081"></a><div class="linenumber">2081</div><div style="width:6em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line2082"></a><div class="linenumber">2082</div><div style="width:8em;display:inline-block"></div>return&nbsp;false;
<a name="line2083"></a><div class="linenumber">2083</div><div style="width:6em;display:inline-block"></div>}
<a name="line2084"></a><div class="linenumber">2084</div><div style="width:4em;display:inline-block"></div>};
<a name="line2085"></a><div class="linenumber">2085</div><div style="width:0em;display:inline-block"></div>
<a name="line2086"></a><div class="linenumber">2086</div><div style="width:0em;display:inline-block"></div>
<a name="line2087"></a><div class="linenumber">2087</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2088"></a><div class="linenumber">2088</div><div style="width:4em;display:inline-block"></div>*&nbsp;Gets&nbsp;connection&nbsp;status&nbsp;for&nbsp;the&nbsp;connection.&nbsp;It&nbsp;is&nbsp;possible&nbsp;for&nbsp;a&nbsp;connection&nbsp;to&nbsp;be&nbsp;considered&nbsp;connected&nbsp;without&nbsp;being&nbsp;authenticated.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line2089"></a><div class="linenumber">2089</div><div style="width:4em;display:inline-block"></div>*
<a name="line2090"></a><div class="linenumber">2090</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line2091"></a><div class="linenumber">2091</div><div style="width:4em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Boolean}&nbsp;&nbsp;&nbsp;Connection&nbsp;status
<a name="line2092"></a><div class="linenumber">2092</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2093"></a><div class="linenumber">2093</div><div style="width:4em;display:inline-block"></div>connectionObj.isConnected&nbsp;=&nbsp;function()&nbsp;{
<a name="line2094"></a><div class="linenumber">2094</div><div style="width:6em;display:inline-block"></div>if&nbsp;(connectionObj.socket&nbsp;&amp;&amp;&nbsp;connectionObj.socket.socket)&nbsp;{
<a name="line2095"></a><div class="linenumber">2095</div><div style="width:8em;display:inline-block"></div>return&nbsp;connectionObj.socket.socket.connected;
<a name="line2096"></a><div class="linenumber">2096</div><div style="width:6em;display:inline-block"></div>}
<a name="line2097"></a><div class="linenumber">2097</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line2098"></a><div class="linenumber">2098</div><div style="width:8em;display:inline-block"></div>return&nbsp;false;
<a name="line2099"></a><div class="linenumber">2099</div><div style="width:6em;display:inline-block"></div>}
<a name="line2100"></a><div class="linenumber">2100</div><div style="width:4em;display:inline-block"></div>};
<a name="line2101"></a><div class="linenumber">2101</div><div style="width:0em;display:inline-block"></div>
<a name="line2102"></a><div class="linenumber">2102</div><div style="width:0em;display:inline-block"></div>
<a name="line2103"></a><div class="linenumber">2103</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2104"></a><div class="linenumber">2104</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;a&nbsp;boolean&nbsp;to&nbsp;the&nbsp;callback&nbsp;indicating&nbsp;if&nbsp;connection&nbsp;is&nbsp;in&nbsp;a&nbsp;given&nbsp;group.&nbsp;NOT&nbsp;YET&nbsp;IMPLEMENTED
<a name="line2105"></a><div class="linenumber">2105</div><div style="width:4em;display:inline-block"></div>*&nbsp;@ignore
<a name="line2106"></a><div class="linenumber">2106</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line2107"></a><div class="linenumber">2107</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;groupName&nbsp;Group&nbsp;name&nbsp;to&nbsp;check.
<a name="line2108"></a><div class="linenumber">2108</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Boolean)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;a&nbsp;boolean&nbsp;indicating&nbsp;if&nbsp;connection&nbsp;is&nbsp;in&nbsp;a&nbsp;room..
<a name="line2109"></a><div class="linenumber">2109</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2110"></a><div class="linenumber">2110</div><div style="width:4em;display:inline-block"></div>connectionObj.isInGroup&nbsp;=&nbsp;function(groupName,&nbsp;callback)&nbsp;{
<a name="line2111"></a><div class="linenumber">2111</div><div style="width:6em;display:inline-block"></div>if&nbsp;(_.isString(groupName)&nbsp;&amp;&amp;&nbsp;e.app[appName].connection[easyrtcid].group[groupName]&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line2112"></a><div class="linenumber">2112</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;true);
<a name="line2113"></a><div class="linenumber">2113</div><div style="width:6em;display:inline-block"></div>}
<a name="line2114"></a><div class="linenumber">2114</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line2115"></a><div class="linenumber">2115</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;false);
<a name="line2116"></a><div class="linenumber">2116</div><div style="width:6em;display:inline-block"></div>}
<a name="line2117"></a><div class="linenumber">2117</div><div style="width:4em;display:inline-block"></div>};
<a name="line2118"></a><div class="linenumber">2118</div><div style="width:0em;display:inline-block"></div>
<a name="line2119"></a><div class="linenumber">2119</div><div style="width:0em;display:inline-block"></div>
<a name="line2120"></a><div class="linenumber">2120</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2121"></a><div class="linenumber">2121</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;a&nbsp;boolean&nbsp;to&nbsp;the&nbsp;callback&nbsp;indicating&nbsp;if&nbsp;connection&nbsp;is&nbsp;in&nbsp;a&nbsp;given&nbsp;room
<a name="line2122"></a><div class="linenumber">2122</div><div style="width:4em;display:inline-block"></div>*
<a name="line2123"></a><div class="linenumber">2123</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line2124"></a><div class="linenumber">2124</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line2125"></a><div class="linenumber">2125</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Boolean)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;a&nbsp;boolean&nbsp;indicating&nbsp;if&nbsp;connection&nbsp;is&nbsp;in&nbsp;a&nbsp;room..
<a name="line2126"></a><div class="linenumber">2126</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2127"></a><div class="linenumber">2127</div><div style="width:4em;display:inline-block"></div>connectionObj.isInRoom&nbsp;=&nbsp;function(roomName,&nbsp;callback)&nbsp;{
<a name="line2128"></a><div class="linenumber">2128</div><div style="width:6em;display:inline-block"></div>if&nbsp;(_.isString(roomName)&nbsp;&amp;&amp;&nbsp;e.app[appName].connection[easyrtcid].room[roomName]&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line2129"></a><div class="linenumber">2129</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;true);
<a name="line2130"></a><div class="linenumber">2130</div><div style="width:6em;display:inline-block"></div>}
<a name="line2131"></a><div class="linenumber">2131</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line2132"></a><div class="linenumber">2132</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;false);
<a name="line2133"></a><div class="linenumber">2133</div><div style="width:6em;display:inline-block"></div>}
<a name="line2134"></a><div class="linenumber">2134</div><div style="width:4em;display:inline-block"></div>};
<a name="line2135"></a><div class="linenumber">2135</div><div style="width:0em;display:inline-block"></div>
<a name="line2136"></a><div class="linenumber">2136</div><div style="width:0em;display:inline-block"></div>
<a name="line2137"></a><div class="linenumber">2137</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2138"></a><div class="linenumber">2138</div><div style="width:4em;display:inline-block"></div>*&nbsp;Joins&nbsp;an&nbsp;existing&nbsp;room,&nbsp;returning&nbsp;a&nbsp;connectionRoom&nbsp;object.
<a name="line2139"></a><div class="linenumber">2139</div><div style="width:4em;display:inline-block"></div>*
<a name="line2140"></a><div class="linenumber">2140</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line2141"></a><div class="linenumber">2141</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line2142"></a><div class="linenumber">2142</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;EasyRTC&nbsp;connection&nbsp;room&nbsp;object&nbsp;(same&nbsp;as&nbsp;calling&nbsp;room(roomName))
<a name="line2143"></a><div class="linenumber">2143</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2144"></a><div class="linenumber">2144</div><div style="width:4em;display:inline-block"></div>connectionObj.joinRoom&nbsp;=&nbsp;function(roomName,&nbsp;callback)&nbsp;{
<a name="line2145"></a><div class="linenumber">2145</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!roomName&nbsp;||&nbsp;!appObj.getOption("roomNameRegExp").test(roomName))&nbsp;{
<a name="line2146"></a><div class="linenumber">2146</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Can&nbsp;not&nbsp;enter&nbsp;room&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line2147"></a><div class="linenumber">2147</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Can&nbsp;not&nbsp;enter&nbsp;room&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2148"></a><div class="linenumber">2148</div><div style="width:8em;display:inline-block"></div>return;
<a name="line2149"></a><div class="linenumber">2149</div><div style="width:6em;display:inline-block"></div>}
<a name="line2150"></a><div class="linenumber">2150</div><div style="width:6em;display:inline-block"></div>//&nbsp;Check&nbsp;if&nbsp;room&nbsp;doesn't&nbsp;exist
<a name="line2151"></a><div class="linenumber">2151</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line2152"></a><div class="linenumber">2152</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Can&nbsp;not&nbsp;enter&nbsp;room&nbsp;which&nbsp;doesn't&nbsp;exist:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line2153"></a><div class="linenumber">2153</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Can&nbsp;not&nbsp;enter&nbsp;room&nbsp;which&nbsp;doesn't&nbsp;exist:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2154"></a><div class="linenumber">2154</div><div style="width:8em;display:inline-block"></div>return;
<a name="line2155"></a><div class="linenumber">2155</div><div style="width:6em;display:inline-block"></div>}
<a name="line2156"></a><div class="linenumber">2156</div><div style="width:0em;display:inline-block"></div>
<a name="line2157"></a><div class="linenumber">2157</div><div style="width:6em;display:inline-block"></div>//&nbsp;Check&nbsp;if&nbsp;client&nbsp;already&nbsp;in&nbsp;room
<a name="line2158"></a><div class="linenumber">2158</div><div style="width:6em;display:inline-block"></div>if&nbsp;(e.app[appName].connection[easyrtcid].room[roomName])&nbsp;{
<a name="line2159"></a><div class="linenumber">2159</div><div style="width:8em;display:inline-block"></div>connectionObj.room(roomName,&nbsp;callback);
<a name="line2160"></a><div class="linenumber">2160</div><div style="width:8em;display:inline-block"></div>return;
<a name="line2161"></a><div class="linenumber">2161</div><div style="width:6em;display:inline-block"></div>}
<a name="line2162"></a><div class="linenumber">2162</div><div style="width:0em;display:inline-block"></div>
<a name="line2163"></a><div class="linenumber">2163</div><div style="width:6em;display:inline-block"></div>//&nbsp;Local&nbsp;private&nbsp;function&nbsp;to&nbsp;create&nbsp;the&nbsp;default&nbsp;connection-room&nbsp;object&nbsp;in&nbsp;the&nbsp;private&nbsp;variable
<a name="line2164"></a><div class="linenumber">2164</div><div style="width:6em;display:inline-block"></div>var&nbsp;createConnectionRoom&nbsp;=&nbsp;function(roomName,&nbsp;appRoomObj,&nbsp;callback)&nbsp;{
<a name="line2165"></a><div class="linenumber">2165</div><div style="width:8em;display:inline-block"></div>//&nbsp;Join&nbsp;room.&nbsp;Creates&nbsp;a&nbsp;default&nbsp;connection&nbsp;room&nbsp;object
<a name="line2166"></a><div class="linenumber">2166</div><div style="width:8em;display:inline-block"></div>e.app[appName].connection[easyrtcid].room[roomName]&nbsp;=&nbsp;{
<a name="line2167"></a><div class="linenumber">2167</div><div style="width:10em;display:inline-block"></div>apiField:&nbsp;{},
<a name="line2168"></a><div class="linenumber">2168</div><div style="width:10em;display:inline-block"></div>enteredOn:&nbsp;Date.now(),
<a name="line2169"></a><div class="linenumber">2169</div><div style="width:10em;display:inline-block"></div>gotListOn:&nbsp;Date.now(),
<a name="line2170"></a><div class="linenumber">2170</div><div style="width:10em;display:inline-block"></div>clientList:&nbsp;{},
<a name="line2171"></a><div class="linenumber">2171</div><div style="width:10em;display:inline-block"></div>toRoom:&nbsp;e.app[appName].room[roomName]
<a name="line2172"></a><div class="linenumber">2172</div><div style="width:8em;display:inline-block"></div>};
<a name="line2173"></a><div class="linenumber">2173</div><div style="width:0em;display:inline-block"></div>
<a name="line2174"></a><div class="linenumber">2174</div><div style="width:8em;display:inline-block"></div>//&nbsp;Add&nbsp;easyrtcid&nbsp;to&nbsp;room&nbsp;clientList
<a name="line2175"></a><div class="linenumber">2175</div><div style="width:8em;display:inline-block"></div>e.app[appName].room[roomName].clientList[easyrtcid]&nbsp;=&nbsp;{
<a name="line2176"></a><div class="linenumber">2176</div><div style="width:10em;display:inline-block"></div>enteredOn:&nbsp;Date.now(),
<a name="line2177"></a><div class="linenumber">2177</div><div style="width:10em;display:inline-block"></div>modifiedOn:&nbsp;Date.now(),
<a name="line2178"></a><div class="linenumber">2178</div><div style="width:10em;display:inline-block"></div>toConnection:&nbsp;e.app[appName].connection[easyrtcid]
<a name="line2179"></a><div class="linenumber">2179</div><div style="width:8em;display:inline-block"></div>};
<a name="line2180"></a><div class="linenumber">2180</div><div style="width:0em;display:inline-block"></div>
<a name="line2181"></a><div class="linenumber">2181</div><div style="width:8em;display:inline-block"></div>//&nbsp;Returns&nbsp;connection&nbsp;room&nbsp;object&nbsp;to&nbsp;callback.
<a name="line2182"></a><div class="linenumber">2182</div><div style="width:8em;display:inline-block"></div>connectionObj.room(roomName,&nbsp;callback);
<a name="line2183"></a><div class="linenumber">2183</div><div style="width:6em;display:inline-block"></div>};
<a name="line2184"></a><div class="linenumber">2184</div><div style="width:0em;display:inline-block"></div>
<a name="line2185"></a><div class="linenumber">2185</div><div style="width:6em;display:inline-block"></div>appObj.room(roomName,&nbsp;function(err,&nbsp;appRoomObj)&nbsp;{
<a name="line2186"></a><div class="linenumber">2186</div><div style="width:8em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line2187"></a><div class="linenumber">2187</div><div style="width:10em;display:inline-block"></div>callback(err);
<a name="line2188"></a><div class="linenumber">2188</div><div style="width:10em;display:inline-block"></div>return;
<a name="line2189"></a><div class="linenumber">2189</div><div style="width:8em;display:inline-block"></div>}
<a name="line2190"></a><div class="linenumber">2190</div><div style="width:8em;display:inline-block"></div>createConnectionRoom(roomName,&nbsp;appRoomObj,&nbsp;callback);
<a name="line2191"></a><div class="linenumber">2191</div><div style="width:6em;display:inline-block"></div>});
<a name="line2192"></a><div class="linenumber">2192</div><div style="width:4em;display:inline-block"></div>};
<a name="line2193"></a><div class="linenumber">2193</div><div style="width:0em;display:inline-block"></div>
<a name="line2194"></a><div class="linenumber">2194</div><div style="width:0em;display:inline-block"></div>
<a name="line2195"></a><div class="linenumber">2195</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2196"></a><div class="linenumber">2196</div><div style="width:4em;display:inline-block"></div>*&nbsp;Gets&nbsp;room&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;room&nbsp;name.&nbsp;Returns&nbsp;null&nbsp;if&nbsp;room&nbsp;not&nbsp;found.
<a name="line2197"></a><div class="linenumber">2197</div><div style="width:4em;display:inline-block"></div>*&nbsp;The&nbsp;returned&nbsp;room&nbsp;object&nbsp;includes&nbsp;functions&nbsp;for&nbsp;managing&nbsp;room&nbsp;fields.
<a name="line2198"></a><div class="linenumber">2198</div><div style="width:4em;display:inline-block"></div>*
<a name="line2199"></a><div class="linenumber">2199</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line2200"></a><div class="linenumber">2200</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line2201"></a><div class="linenumber">2201</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;EasyRTC&nbsp;connection&nbsp;room&nbsp;object.
<a name="line2202"></a><div class="linenumber">2202</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2203"></a><div class="linenumber">2203</div><div style="width:4em;display:inline-block"></div>connectionObj.room&nbsp;=&nbsp;function(roomName,&nbsp;callback)&nbsp;{
<a name="line2204"></a><div class="linenumber">2204</div><div style="width:6em;display:inline-block"></div>if&nbsp;(_.isUndefined(e.app[appName].connection[easyrtcid].room[roomName]))&nbsp;{
<a name="line2205"></a><div class="linenumber">2205</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line2206"></a><div class="linenumber">2206</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2207"></a><div class="linenumber">2207</div><div style="width:8em;display:inline-block"></div>return;
<a name="line2208"></a><div class="linenumber">2208</div><div style="width:6em;display:inline-block"></div>}
<a name="line2209"></a><div class="linenumber">2209</div><div style="width:0em;display:inline-block"></div>
<a name="line2210"></a><div class="linenumber">2210</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2211"></a><div class="linenumber">2211</div><div style="width:6em;display:inline-block"></div>*&nbsp;This&nbsp;is&nbsp;a&nbsp;gateway&nbsp;object&nbsp;connecting&nbsp;connections&nbsp;to&nbsp;the&nbsp;rooms&nbsp;they&nbsp;are&nbsp;in.
<a name="line2212"></a><div class="linenumber">2212</div><div style="width:6em;display:inline-block"></div>*
<a name="line2213"></a><div class="linenumber">2213</div><div style="width:6em;display:inline-block"></div>*&nbsp;@class&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connectionRoomObj
<a name="line2214"></a><div class="linenumber">2214</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line2215"></a><div class="linenumber">2215</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2216"></a><div class="linenumber">2216</div><div style="width:6em;display:inline-block"></div>var&nbsp;connectionRoomObj&nbsp;=&nbsp;{};
<a name="line2217"></a><div class="linenumber">2217</div><div style="width:0em;display:inline-block"></div>
<a name="line2218"></a><div class="linenumber">2218</div><div style="width:6em;display:inline-block"></div>//&nbsp;House&nbsp;the&nbsp;local&nbsp;room&nbsp;object
<a name="line2219"></a><div class="linenumber">2219</div><div style="width:6em;display:inline-block"></div>var&nbsp;_roomObj;
<a name="line2220"></a><div class="linenumber">2220</div><div style="width:0em;display:inline-block"></div>
<a name="line2221"></a><div class="linenumber">2221</div><div style="width:0em;display:inline-block"></div>
<a name="line2222"></a><div class="linenumber">2222</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2223"></a><div class="linenumber">2223</div><div style="width:6em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;event&nbsp;functions
<a name="line2224"></a><div class="linenumber">2224</div><div style="width:6em;display:inline-block"></div>*&nbsp;
<a name="line2225"></a><div class="linenumber">2225</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj.connectionRoomObj
<a name="line2226"></a><div class="linenumber">2226</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2227"></a><div class="linenumber">2227</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.events&nbsp;=&nbsp;pub.events;
<a name="line2228"></a><div class="linenumber">2228</div><div style="width:0em;display:inline-block"></div>
<a name="line2229"></a><div class="linenumber">2229</div><div style="width:0em;display:inline-block"></div>
<a name="line2230"></a><div class="linenumber">2230</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2231"></a><div class="linenumber">2231</div><div style="width:6em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;utility&nbsp;functions
<a name="line2232"></a><div class="linenumber">2232</div><div style="width:6em;display:inline-block"></div>*&nbsp;
<a name="line2233"></a><div class="linenumber">2233</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj.connectionRoomObj
<a name="line2234"></a><div class="linenumber">2234</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2235"></a><div class="linenumber">2235</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.util&nbsp;=&nbsp;pub.util;
<a name="line2236"></a><div class="linenumber">2236</div><div style="width:0em;display:inline-block"></div>
<a name="line2237"></a><div class="linenumber">2237</div><div style="width:0em;display:inline-block"></div>
<a name="line2238"></a><div class="linenumber">2238</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2239"></a><div class="linenumber">2239</div><div style="width:6em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;application&nbsp;object&nbsp;to&nbsp;which&nbsp;the&nbsp;connection&nbsp;belongs.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line2240"></a><div class="linenumber">2240</div><div style="width:6em;display:inline-block"></div>*
<a name="line2241"></a><div class="linenumber">2241</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj.connectionRoomObj
<a name="line2242"></a><div class="linenumber">2242</div><div style="width:6em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;application&nbsp;object
<a name="line2243"></a><div class="linenumber">2243</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2244"></a><div class="linenumber">2244</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.getApp&nbsp;=&nbsp;function()&nbsp;{
<a name="line2245"></a><div class="linenumber">2245</div><div style="width:8em;display:inline-block"></div>return&nbsp;appObj;
<a name="line2246"></a><div class="linenumber">2246</div><div style="width:6em;display:inline-block"></div>};
<a name="line2247"></a><div class="linenumber">2247</div><div style="width:0em;display:inline-block"></div>
<a name="line2248"></a><div class="linenumber">2248</div><div style="width:0em;display:inline-block"></div>
<a name="line2249"></a><div class="linenumber">2249</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2250"></a><div class="linenumber">2250</div><div style="width:6em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;application&nbsp;name&nbsp;for&nbsp;the&nbsp;application&nbsp;to&nbsp;which&nbsp;the&nbsp;connection&nbsp;belongs.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line2251"></a><div class="linenumber">2251</div><div style="width:6em;display:inline-block"></div>*
<a name="line2252"></a><div class="linenumber">2252</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj.connectionRoomObj
<a name="line2253"></a><div class="linenumber">2253</div><div style="width:6em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;application&nbsp;name
<a name="line2254"></a><div class="linenumber">2254</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2255"></a><div class="linenumber">2255</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.getAppName&nbsp;=&nbsp;function()&nbsp;{
<a name="line2256"></a><div class="linenumber">2256</div><div style="width:8em;display:inline-block"></div>return&nbsp;appName;
<a name="line2257"></a><div class="linenumber">2257</div><div style="width:6em;display:inline-block"></div>};
<a name="line2258"></a><div class="linenumber">2258</div><div style="width:0em;display:inline-block"></div>
<a name="line2259"></a><div class="linenumber">2259</div><div style="width:0em;display:inline-block"></div>
<a name="line2260"></a><div class="linenumber">2260</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2261"></a><div class="linenumber">2261</div><div style="width:6em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;connection&nbsp;object&nbsp;to&nbsp;which&nbsp;the&nbsp;connection&nbsp;belongs.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line2262"></a><div class="linenumber">2262</div><div style="width:6em;display:inline-block"></div>*
<a name="line2263"></a><div class="linenumber">2263</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj.connectionRoomObj
<a name="line2264"></a><div class="linenumber">2264</div><div style="width:6em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;application&nbsp;object
<a name="line2265"></a><div class="linenumber">2265</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2266"></a><div class="linenumber">2266</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.getConnection&nbsp;=&nbsp;function()&nbsp;{
<a name="line2267"></a><div class="linenumber">2267</div><div style="width:8em;display:inline-block"></div>return&nbsp;connectionObj;
<a name="line2268"></a><div class="linenumber">2268</div><div style="width:6em;display:inline-block"></div>};
<a name="line2269"></a><div class="linenumber">2269</div><div style="width:0em;display:inline-block"></div>
<a name="line2270"></a><div class="linenumber">2270</div><div style="width:0em;display:inline-block"></div>
<a name="line2271"></a><div class="linenumber">2271</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2272"></a><div class="linenumber">2272</div><div style="width:6em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;room&nbsp;object&nbsp;to&nbsp;which&nbsp;the&nbsp;connection&nbsp;belongs.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line2273"></a><div class="linenumber">2273</div><div style="width:6em;display:inline-block"></div>*
<a name="line2274"></a><div class="linenumber">2274</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj.connectionRoomObj
<a name="line2275"></a><div class="linenumber">2275</div><div style="width:6em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;room&nbsp;object
<a name="line2276"></a><div class="linenumber">2276</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2277"></a><div class="linenumber">2277</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.getRoom&nbsp;=&nbsp;function()&nbsp;{
<a name="line2278"></a><div class="linenumber">2278</div><div style="width:8em;display:inline-block"></div>return&nbsp;_roomObj;
<a name="line2279"></a><div class="linenumber">2279</div><div style="width:6em;display:inline-block"></div>};
<a name="line2280"></a><div class="linenumber">2280</div><div style="width:0em;display:inline-block"></div>
<a name="line2281"></a><div class="linenumber">2281</div><div style="width:0em;display:inline-block"></div>
<a name="line2282"></a><div class="linenumber">2282</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2283"></a><div class="linenumber">2283</div><div style="width:6em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;room&nbsp;name&nbsp;to&nbsp;which&nbsp;the&nbsp;connection&nbsp;belongs.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line2284"></a><div class="linenumber">2284</div><div style="width:6em;display:inline-block"></div>*
<a name="line2285"></a><div class="linenumber">2285</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj.connectionRoomObj
<a name="line2286"></a><div class="linenumber">2286</div><div style="width:6em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;room&nbsp;name
<a name="line2287"></a><div class="linenumber">2287</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2288"></a><div class="linenumber">2288</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.getRoomName&nbsp;=&nbsp;function()&nbsp;{
<a name="line2289"></a><div class="linenumber">2289</div><div style="width:8em;display:inline-block"></div>return&nbsp;roomName;
<a name="line2290"></a><div class="linenumber">2290</div><div style="width:6em;display:inline-block"></div>};
<a name="line2291"></a><div class="linenumber">2291</div><div style="width:0em;display:inline-block"></div>
<a name="line2292"></a><div class="linenumber">2292</div><div style="width:0em;display:inline-block"></div>
<a name="line2293"></a><div class="linenumber">2293</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2294"></a><div class="linenumber">2294</div><div style="width:6em;display:inline-block"></div>*&nbsp;Leaves&nbsp;the&nbsp;current&nbsp;room.&nbsp;Any&nbsp;room&nbsp;variables&nbsp;will&nbsp;be&nbsp;lost.
<a name="line2295"></a><div class="linenumber">2295</div><div style="width:6em;display:inline-block"></div>*
<a name="line2296"></a><div class="linenumber">2296</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj.connectionRoomObj
<a name="line2297"></a><div class="linenumber">2297</div><div style="width:6em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;[next]&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line2298"></a><div class="linenumber">2298</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2299"></a><div class="linenumber">2299</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.leaveRoom&nbsp;=&nbsp;function(next)&nbsp;{
<a name="line2300"></a><div class="linenumber">2300</div><div style="width:8em;display:inline-block"></div>if&nbsp;(!_.isFunction(next))&nbsp;{
<a name="line2301"></a><div class="linenumber">2301</div><div style="width:10em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line2302"></a><div class="linenumber">2302</div><div style="width:8em;display:inline-block"></div>}
<a name="line2303"></a><div class="linenumber">2303</div><div style="width:0em;display:inline-block"></div>
<a name="line2304"></a><div class="linenumber">2304</div><div style="width:8em;display:inline-block"></div>if&nbsp;(appObj.isRoomSync(roomName)){
<a name="line2305"></a><div class="linenumber">2305</div><div style="width:10em;display:inline-block"></div>e.app[appName].room[roomName].modifiedOn&nbsp;=&nbsp;Date.now();
<a name="line2306"></a><div class="linenumber">2306</div><div style="width:10em;display:inline-block"></div>delete&nbsp;e.app[appName].room[roomName].clientList[easyrtcid];
<a name="line2307"></a><div class="linenumber">2307</div><div style="width:8em;display:inline-block"></div>}
<a name="line2308"></a><div class="linenumber">2308</div><div style="width:0em;display:inline-block"></div>
<a name="line2309"></a><div class="linenumber">2309</div><div style="width:8em;display:inline-block"></div>if&nbsp;(e.app[appName].connection[easyrtcid]){
<a name="line2310"></a><div class="linenumber">2310</div><div style="width:10em;display:inline-block"></div>delete&nbsp;e.app[appName].connection[easyrtcid].room[roomName];
<a name="line2311"></a><div class="linenumber">2311</div><div style="width:8em;display:inline-block"></div>}
<a name="line2312"></a><div class="linenumber">2312</div><div style="width:0em;display:inline-block"></div>
<a name="line2313"></a><div class="linenumber">2313</div><div style="width:8em;display:inline-block"></div>connectionRoomObj.emitRoomDataDelta(true,&nbsp;function(err,&nbsp;roomDataObj)&nbsp;{
<a name="line2314"></a><div class="linenumber">2314</div><div style="width:10em;display:inline-block"></div>next(err);
<a name="line2315"></a><div class="linenumber">2315</div><div style="width:8em;display:inline-block"></div>});
<a name="line2316"></a><div class="linenumber">2316</div><div style="width:6em;display:inline-block"></div>};
<a name="line2317"></a><div class="linenumber">2317</div><div style="width:0em;display:inline-block"></div>
<a name="line2318"></a><div class="linenumber">2318</div><div style="width:0em;display:inline-block"></div>
<a name="line2319"></a><div class="linenumber">2319</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2320"></a><div class="linenumber">2320</div><div style="width:6em;display:inline-block"></div>*&nbsp;Emits&nbsp;the&nbsp;roomData&nbsp;message&nbsp;with&nbsp;a&nbsp;clientListDelta&nbsp;for&nbsp;the&nbsp;current&nbsp;connection&nbsp;to&nbsp;other&nbsp;connections&nbsp;in&nbsp;the&nbsp;same&nbsp;room.
<a name="line2321"></a><div class="linenumber">2321</div><div style="width:6em;display:inline-block"></div>*
<a name="line2322"></a><div class="linenumber">2322</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj.connectionRoomObj
<a name="line2323"></a><div class="linenumber">2323</div><div style="width:6em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{boolean}&nbsp;&nbsp;&nbsp;isLeavingRoom&nbsp;&nbsp;&nbsp;Is&nbsp;connection&nbsp;leaving&nbsp;the&nbsp;room?
<a name="line2324"></a><div class="linenumber">2324</div><div style="width:6em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;room&nbsp;data&nbsp;delta&nbsp;object.
<a name="line2325"></a><div class="linenumber">2325</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2326"></a><div class="linenumber">2326</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.emitRoomDataDelta&nbsp;=&nbsp;function(isLeavingRoom,&nbsp;callback)&nbsp;{
<a name="line2327"></a><div class="linenumber">2327</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Room&nbsp;["&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"]&nbsp;Running&nbsp;func&nbsp;'connectionRoomObj.emitRoomDataDelta'");
<a name="line2328"></a><div class="linenumber">2328</div><div style="width:8em;display:inline-block"></div>if&nbsp;(!_.isFunction(callback))&nbsp;{
<a name="line2329"></a><div class="linenumber">2329</div><div style="width:10em;display:inline-block"></div>callback&nbsp;=&nbsp;function(err,&nbsp;roomDataObj)&nbsp;{
<a name="line2330"></a><div class="linenumber">2330</div><div style="width:10em;display:inline-block"></div>};
<a name="line2331"></a><div class="linenumber">2331</div><div style="width:8em;display:inline-block"></div>}
<a name="line2332"></a><div class="linenumber">2332</div><div style="width:0em;display:inline-block"></div>
<a name="line2333"></a><div class="linenumber">2333</div><div style="width:8em;display:inline-block"></div>connectionRoomObj.generateRoomDataDelta(isLeavingRoom,&nbsp;function(err,&nbsp;roomDataDelta)&nbsp;{
<a name="line2334"></a><div class="linenumber">2334</div><div style="width:10em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line2335"></a><div class="linenumber">2335</div><div style="width:12em;display:inline-block"></div>callback(err);
<a name="line2336"></a><div class="linenumber">2336</div><div style="width:12em;display:inline-block"></div>return;
<a name="line2337"></a><div class="linenumber">2337</div><div style="width:10em;display:inline-block"></div>}
<a name="line2338"></a><div class="linenumber">2338</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line2339"></a><div class="linenumber">2339</div><div style="width:12em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line2340"></a><div class="linenumber">2340</div><div style="width:12em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2341"></a><div class="linenumber">2341</div><div style="width:12em;display:inline-block"></div>return;
<a name="line2342"></a><div class="linenumber">2342</div><div style="width:10em;display:inline-block"></div>}
<a name="line2343"></a><div class="linenumber">2343</div><div style="width:0em;display:inline-block"></div>
<a name="line2344"></a><div class="linenumber">2344</div><div style="width:10em;display:inline-block"></div>var&nbsp;msg&nbsp;=&nbsp;{"msgData":&nbsp;{"roomData":&nbsp;{}}};
<a name="line2345"></a><div class="linenumber">2345</div><div style="width:10em;display:inline-block"></div>msg.msgData.roomData[roomName]&nbsp;=&nbsp;roomDataDelta;
<a name="line2346"></a><div class="linenumber">2346</div><div style="width:0em;display:inline-block"></div>
<a name="line2347"></a><div class="linenumber">2347</div><div style="width:10em;display:inline-block"></div>for&nbsp;(var&nbsp;currentEasyrtcid&nbsp;in&nbsp;e.app[appName].room[roomName].clientList)&nbsp;{
<a name="line2348"></a><div class="linenumber">2348</div><div style="width:12em;display:inline-block"></div>//&nbsp;Anonymous&nbsp;wrapper&nbsp;to&nbsp;deliver&nbsp;arguments
<a name="line2349"></a><div class="linenumber">2349</div><div style="width:12em;display:inline-block"></div>(function(innerCurrentEasyrtcid,&nbsp;innerMsg){
<a name="line2350"></a><div class="linenumber">2350</div><div style="width:14em;display:inline-block"></div>connectionObj.getApp().connection(innerCurrentEasyrtcid,&nbsp;function(err,&nbsp;emitToConnectionObj)&nbsp;{
<a name="line2351"></a><div class="linenumber">2351</div><div style="width:16em;display:inline-block"></div>if&nbsp;(!err&nbsp;&amp;&amp;&nbsp;innerCurrentEasyrtcid&nbsp;!=&nbsp;easyrtcid&nbsp;&amp;&amp;&nbsp;emitToConnectionObj)&nbsp;{
<a name="line2352"></a><div class="linenumber">2352</div><div style="width:18em;display:inline-block"></div>pub.events.emit("emitEasyrtcCmd",&nbsp;emitToConnectionObj,&nbsp;"roomData",&nbsp;innerMsg,&nbsp;null,&nbsp;function()&nbsp;{
<a name="line2353"></a><div class="linenumber">2353</div><div style="width:18em;display:inline-block"></div>});
<a name="line2354"></a><div class="linenumber">2354</div><div style="width:16em;display:inline-block"></div>}
<a name="line2355"></a><div class="linenumber">2355</div><div style="width:14em;display:inline-block"></div>});
<a name="line2356"></a><div class="linenumber">2356</div><div style="width:12em;display:inline-block"></div>})(currentEasyrtcid,&nbsp;msg);
<a name="line2357"></a><div class="linenumber">2357</div><div style="width:0em;display:inline-block"></div>
<a name="line2358"></a><div class="linenumber">2358</div><div style="width:10em;display:inline-block"></div>}
<a name="line2359"></a><div class="linenumber">2359</div><div style="width:10em;display:inline-block"></div>callback(null,&nbsp;roomDataDelta);
<a name="line2360"></a><div class="linenumber">2360</div><div style="width:8em;display:inline-block"></div>});
<a name="line2361"></a><div class="linenumber">2361</div><div style="width:6em;display:inline-block"></div>};
<a name="line2362"></a><div class="linenumber">2362</div><div style="width:0em;display:inline-block"></div>
<a name="line2363"></a><div class="linenumber">2363</div><div style="width:0em;display:inline-block"></div>
<a name="line2364"></a><div class="linenumber">2364</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2365"></a><div class="linenumber">2365</div><div style="width:6em;display:inline-block"></div>*&nbsp;Generated&nbsp;the&nbsp;roomData[room]&nbsp;message&nbsp;with&nbsp;a&nbsp;clientListDelta&nbsp;for&nbsp;the&nbsp;current&nbsp;connection&nbsp;to&nbsp;other&nbsp;connections&nbsp;in&nbsp;the&nbsp;same&nbsp;room.
<a name="line2366"></a><div class="linenumber">2366</div><div style="width:6em;display:inline-block"></div>*
<a name="line2367"></a><div class="linenumber">2367</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj.connectionRoomObj
<a name="line2368"></a><div class="linenumber">2368</div><div style="width:6em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{boolean}&nbsp;&nbsp;&nbsp;isLeavingRoom&nbsp;&nbsp;&nbsp;Is&nbsp;connection&nbsp;leaving&nbsp;the&nbsp;room?
<a name="line2369"></a><div class="linenumber">2369</div><div style="width:6em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;room&nbsp;data&nbsp;delta&nbsp;object.
<a name="line2370"></a><div class="linenumber">2370</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2371"></a><div class="linenumber">2371</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.generateRoomDataDelta&nbsp;=&nbsp;function(isLeavingRoom,&nbsp;callback)&nbsp;{
<a name="line2372"></a><div class="linenumber">2372</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Room&nbsp;["&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"]&nbsp;Running&nbsp;func&nbsp;'connectionRoomObj.generateRoomDataDelta'");
<a name="line2373"></a><div class="linenumber">2373</div><div style="width:8em;display:inline-block"></div>if&nbsp;(!_.isFunction(callback))&nbsp;{
<a name="line2374"></a><div class="linenumber">2374</div><div style="width:10em;display:inline-block"></div>callback&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line2375"></a><div class="linenumber">2375</div><div style="width:8em;display:inline-block"></div>}
<a name="line2376"></a><div class="linenumber">2376</div><div style="width:8em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line2377"></a><div class="linenumber">2377</div><div style="width:10em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line2378"></a><div class="linenumber">2378</div><div style="width:10em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2379"></a><div class="linenumber">2379</div><div style="width:10em;display:inline-block"></div>return;
<a name="line2380"></a><div class="linenumber">2380</div><div style="width:8em;display:inline-block"></div>}
<a name="line2381"></a><div class="linenumber">2381</div><div style="width:8em;display:inline-block"></div>var&nbsp;roomDataDelta&nbsp;=&nbsp;{"roomName":&nbsp;roomName,&nbsp;"roomStatus":&nbsp;"update",&nbsp;"clientListDelta":&nbsp;{}};
<a name="line2382"></a><div class="linenumber">2382</div><div style="width:0em;display:inline-block"></div>
<a name="line2383"></a><div class="linenumber">2383</div><div style="width:8em;display:inline-block"></div>if&nbsp;(isLeavingRoom)&nbsp;{
<a name="line2384"></a><div class="linenumber">2384</div><div style="width:10em;display:inline-block"></div>roomDataDelta.clientListDelta.removeClient&nbsp;=&nbsp;{};
<a name="line2385"></a><div class="linenumber">2385</div><div style="width:10em;display:inline-block"></div>roomDataDelta.clientListDelta.removeClient[easyrtcid]&nbsp;=&nbsp;{"easyrtcid":&nbsp;easyrtcid};
<a name="line2386"></a><div class="linenumber">2386</div><div style="width:8em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line2387"></a><div class="linenumber">2387</div><div style="width:10em;display:inline-block"></div>var&nbsp;connectionRoom&nbsp;=&nbsp;e.app[appName].connection[easyrtcid].room[roomName];
<a name="line2388"></a><div class="linenumber">2388</div><div style="width:10em;display:inline-block"></div>roomDataDelta.clientListDelta.updateClient&nbsp;=&nbsp;{};
<a name="line2389"></a><div class="linenumber">2389</div><div style="width:10em;display:inline-block"></div>roomDataDelta.clientListDelta.updateClient[easyrtcid]&nbsp;=&nbsp;{
<a name="line2390"></a><div class="linenumber">2390</div><div style="width:12em;display:inline-block"></div>"easyrtcid":&nbsp;easyrtcid,
<a name="line2391"></a><div class="linenumber">2391</div><div style="width:12em;display:inline-block"></div>"roomJoinTime":&nbsp;e.app[appName].connection[easyrtcid].room[roomName].enteredOn,
<a name="line2392"></a><div class="linenumber">2392</div><div style="width:12em;display:inline-block"></div>"presence":&nbsp;e.app[appName].connection[easyrtcid].presence
<a name="line2393"></a><div class="linenumber">2393</div><div style="width:10em;display:inline-block"></div>};
<a name="line2394"></a><div class="linenumber">2394</div><div style="width:0em;display:inline-block"></div>
<a name="line2395"></a><div class="linenumber">2395</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isEmpty(e.app[appName].connection[easyrtcid].room[roomName].apiField))&nbsp;{
<a name="line2396"></a><div class="linenumber">2396</div><div style="width:12em;display:inline-block"></div>roomDataDelta.clientListDelta.updateClient[easyrtcid].apiField&nbsp;=&nbsp;e.app[appName].connection[easyrtcid].room[roomName].apiField;
<a name="line2397"></a><div class="linenumber">2397</div><div style="width:10em;display:inline-block"></div>}
<a name="line2398"></a><div class="linenumber">2398</div><div style="width:10em;display:inline-block"></div>if&nbsp;(e.app[appName].connection[easyrtcid].username)&nbsp;{
<a name="line2399"></a><div class="linenumber">2399</div><div style="width:12em;display:inline-block"></div>roomDataDelta.clientListDelta.updateClient[easyrtcid].username&nbsp;=&nbsp;e.app[appName].connection[easyrtcid].username;
<a name="line2400"></a><div class="linenumber">2400</div><div style="width:10em;display:inline-block"></div>}
<a name="line2401"></a><div class="linenumber">2401</div><div style="width:8em;display:inline-block"></div>}
<a name="line2402"></a><div class="linenumber">2402</div><div style="width:0em;display:inline-block"></div>
<a name="line2403"></a><div class="linenumber">2403</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;roomDataDelta);
<a name="line2404"></a><div class="linenumber">2404</div><div style="width:6em;display:inline-block"></div>};
<a name="line2405"></a><div class="linenumber">2405</div><div style="width:0em;display:inline-block"></div>
<a name="line2406"></a><div class="linenumber">2406</div><div style="width:6em;display:inline-block"></div>/**
<a name="line2407"></a><div class="linenumber">2407</div><div style="width:6em;display:inline-block"></div>*&nbsp;Sets&nbsp;the&nbsp;API&nbsp;field&nbsp;for&nbsp;the&nbsp;current&nbsp;connection&nbsp;in&nbsp;a&nbsp;room.
<a name="line2408"></a><div class="linenumber">2408</div><div style="width:6em;display:inline-block"></div>*
<a name="line2409"></a><div class="linenumber">2409</div><div style="width:6em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj.connectionRoomObj
<a name="line2410"></a><div class="linenumber">2410</div><div style="width:6em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{object}&nbsp;&nbsp;&nbsp;&nbsp;apiFieldObj&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;API&nbsp;field&nbsp;object,&nbsp;including&nbsp;the&nbsp;field&nbsp;name&nbsp;and&nbsp;field&nbsp;value.
<a name="line2411"></a><div class="linenumber">2411</div><div style="width:6em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line2412"></a><div class="linenumber">2412</div><div style="width:6em;display:inline-block"></div>*/
<a name="line2413"></a><div class="linenumber">2413</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.setApiField&nbsp;=&nbsp;function(apiFieldObj,&nbsp;next)&nbsp;{
<a name="line2414"></a><div class="linenumber">2414</div><div style="width:8em;display:inline-block"></div>if&nbsp;(!_.isFunction(next))&nbsp;{
<a name="line2415"></a><div class="linenumber">2415</div><div style="width:10em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line2416"></a><div class="linenumber">2416</div><div style="width:8em;display:inline-block"></div>}
<a name="line2417"></a><div class="linenumber">2417</div><div style="width:0em;display:inline-block"></div>
<a name="line2418"></a><div class="linenumber">2418</div><div style="width:8em;display:inline-block"></div>e.app[appName].connection[easyrtcid].room[roomName].apiField&nbsp;=&nbsp;pub.util.deepCopy(apiFieldObj);
<a name="line2419"></a><div class="linenumber">2419</div><div style="width:8em;display:inline-block"></div>next(null);
<a name="line2420"></a><div class="linenumber">2420</div><div style="width:6em;display:inline-block"></div>};
<a name="line2421"></a><div class="linenumber">2421</div><div style="width:0em;display:inline-block"></div>
<a name="line2422"></a><div class="linenumber">2422</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;the&nbsp;roomObj&nbsp;before&nbsp;returning&nbsp;the&nbsp;connectionRoomObj
<a name="line2423"></a><div class="linenumber">2423</div><div style="width:6em;display:inline-block"></div>appObj.room(roomName,
<a name="line2424"></a><div class="linenumber">2424</div><div style="width:10em;display:inline-block"></div>function(err,&nbsp;roomObj)&nbsp;{
<a name="line2425"></a><div class="linenumber">2425</div><div style="width:12em;display:inline-block"></div>_roomObj&nbsp;=&nbsp;roomObj;
<a name="line2426"></a><div class="linenumber">2426</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;connectionRoomObj);
<a name="line2427"></a><div class="linenumber">2427</div><div style="width:10em;display:inline-block"></div>}
<a name="line2428"></a><div class="linenumber">2428</div><div style="width:6em;display:inline-block"></div>);
<a name="line2429"></a><div class="linenumber">2429</div><div style="width:4em;display:inline-block"></div>};
<a name="line2430"></a><div class="linenumber">2430</div><div style="width:0em;display:inline-block"></div>
<a name="line2431"></a><div class="linenumber">2431</div><div style="width:0em;display:inline-block"></div>
<a name="line2432"></a><div class="linenumber">2432</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2433"></a><div class="linenumber">2433</div><div style="width:4em;display:inline-block"></div>*&nbsp;Removes&nbsp;a&nbsp;connection&nbsp;object.&nbsp;Does&nbsp;not&nbsp;(currently)&nbsp;remove&nbsp;connection&nbsp;from&nbsp;rooms&nbsp;or&nbsp;groups.
<a name="line2434"></a><div class="linenumber">2434</div><div style="width:4em;display:inline-block"></div>*
<a name="line2435"></a><div class="linenumber">2435</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.connectionObj
<a name="line2436"></a><div class="linenumber">2436</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line2437"></a><div class="linenumber">2437</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2438"></a><div class="linenumber">2438</div><div style="width:4em;display:inline-block"></div>connectionObj.removeConnection&nbsp;=&nbsp;function(next)&nbsp;{
<a name="line2439"></a><div class="linenumber">2439</div><div style="width:6em;display:inline-block"></div>if&nbsp;(e.app[appName]&nbsp;&amp;&amp;&nbsp;_.isObject(e.app[appName].connection)&nbsp;&amp;&amp;&nbsp;e.app[appName].connection[easyrtcid])&nbsp;{
<a name="line2440"></a><div class="linenumber">2440</div><div style="width:8em;display:inline-block"></div>e.app[appName].connection[easyrtcid].isAuthenticated&nbsp;=&nbsp;false;
<a name="line2441"></a><div class="linenumber">2441</div><div style="width:8em;display:inline-block"></div>//&nbsp;Remove&nbsp;link&nbsp;to&nbsp;connection&nbsp;from&nbsp;session&nbsp;in&nbsp;local&nbsp;storage
<a name="line2442"></a><div class="linenumber">2442</div><div style="width:8em;display:inline-block"></div>if&nbsp;(e.app[appName].connection[easyrtcid].toSession)&nbsp;{
<a name="line2443"></a><div class="linenumber">2443</div><div style="width:10em;display:inline-block"></div>delete&nbsp;e.app[appName].connection[easyrtcid].toSession.toConnection[easyrtcid];
<a name="line2444"></a><div class="linenumber">2444</div><div style="width:8em;display:inline-block"></div>}
<a name="line2445"></a><div class="linenumber">2445</div><div style="width:0em;display:inline-block"></div>
<a name="line2446"></a><div class="linenumber">2446</div><div style="width:8em;display:inline-block"></div>//&nbsp;Remove&nbsp;connection&nbsp;from&nbsp;local&nbsp;storage
<a name="line2447"></a><div class="linenumber">2447</div><div style="width:8em;display:inline-block"></div>delete&nbsp;e.app[appName].connection[easyrtcid];
<a name="line2448"></a><div class="linenumber">2448</div><div style="width:6em;display:inline-block"></div>}
<a name="line2449"></a><div class="linenumber">2449</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line2450"></a><div class="linenumber">2450</div><div style="width:4em;display:inline-block"></div>};
<a name="line2451"></a><div class="linenumber">2451</div><div style="width:0em;display:inline-block"></div>
<a name="line2452"></a><div class="linenumber">2452</div><div style="width:4em;display:inline-block"></div>//&nbsp;Before&nbsp;returning&nbsp;connectionObj,&nbsp;join&nbsp;the&nbsp;connection&nbsp;to&nbsp;a&nbsp;session&nbsp;(if&nbsp;available).
<a name="line2453"></a><div class="linenumber">2453</div><div style="width:4em;display:inline-block"></div>if&nbsp;(e.app[appName].connection[easyrtcid].toSession)&nbsp;{
<a name="line2454"></a><div class="linenumber">2454</div><div style="width:6em;display:inline-block"></div>appObj.session(e.app[appName].connection[easyrtcid].toSession.easyrtcsid,&nbsp;function(err,&nbsp;sessionObj)&nbsp;{
<a name="line2455"></a><div class="linenumber">2455</div><div style="width:8em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line2456"></a><div class="linenumber">2456</div><div style="width:10em;display:inline-block"></div>callback(err);
<a name="line2457"></a><div class="linenumber">2457</div><div style="width:10em;display:inline-block"></div>return;
<a name="line2458"></a><div class="linenumber">2458</div><div style="width:8em;display:inline-block"></div>}
<a name="line2459"></a><div class="linenumber">2459</div><div style="width:8em;display:inline-block"></div>_sessionObj&nbsp;=&nbsp;sessionObj;
<a name="line2460"></a><div class="linenumber">2460</div><div style="width:8em;display:inline-block"></div>callback(null,&nbsp;connectionObj);
<a name="line2461"></a><div class="linenumber">2461</div><div style="width:6em;display:inline-block"></div>});
<a name="line2462"></a><div class="linenumber">2462</div><div style="width:4em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line2463"></a><div class="linenumber">2463</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;connectionObj);
<a name="line2464"></a><div class="linenumber">2464</div><div style="width:4em;display:inline-block"></div>}
<a name="line2465"></a><div class="linenumber">2465</div><div style="width:2em;display:inline-block"></div>};
<a name="line2466"></a><div class="linenumber">2466</div><div style="width:0em;display:inline-block"></div>
<a name="line2467"></a><div class="linenumber">2467</div><div style="width:0em;display:inline-block"></div>
<a name="line2468"></a><div class="linenumber">2468</div><div style="width:2em;display:inline-block"></div>/**
<a name="line2469"></a><div class="linenumber">2469</div><div style="width:2em;display:inline-block"></div>*&nbsp;Creates&nbsp;a&nbsp;new&nbsp;connection&nbsp;with&nbsp;a&nbsp;provided&nbsp;connection&nbsp;key
<a name="line2470"></a><div class="linenumber">2470</div><div style="width:2em;display:inline-block"></div>*
<a name="line2471"></a><div class="linenumber">2471</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line2472"></a><div class="linenumber">2472</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;a&nbsp;socket&nbsp;connection.
<a name="line2473"></a><div class="linenumber">2473</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;socketId&nbsp;&nbsp;&nbsp;&nbsp;Socket.io&nbsp;socket&nbsp;identifier&nbsp;for&nbsp;a&nbsp;socket&nbsp;connection.
<a name="line2474"></a><div class="linenumber">2474</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;EasyRTC&nbsp;connection&nbsp;object&nbsp;(same&nbsp;as&nbsp;calling&nbsp;connection(easyrtcid))
<a name="line2475"></a><div class="linenumber">2475</div><div style="width:2em;display:inline-block"></div>*/
<a name="line2476"></a><div class="linenumber">2476</div><div style="width:2em;display:inline-block"></div>appObj.createConnection&nbsp;=&nbsp;function(easyrtcid,&nbsp;socketId,&nbsp;callback)&nbsp;{
<a name="line2477"></a><div class="linenumber">2477</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!easyrtcid&nbsp;||&nbsp;!appObj.getOption("easyrtcidRegExp").test(easyrtcid))&nbsp;{
<a name="line2478"></a><div class="linenumber">2478</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;connection&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"'");
<a name="line2479"></a><div class="linenumber">2479</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Can&nbsp;not&nbsp;create&nbsp;connection&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"'"));
<a name="line2480"></a><div class="linenumber">2480</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2481"></a><div class="linenumber">2481</div><div style="width:4em;display:inline-block"></div>}
<a name="line2482"></a><div class="linenumber">2482</div><div style="width:0em;display:inline-block"></div>
<a name="line2483"></a><div class="linenumber">2483</div><div style="width:4em;display:inline-block"></div>if&nbsp;(e.app[appName].connection[easyrtcid])&nbsp;{
<a name="line2484"></a><div class="linenumber">2484</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;connection&nbsp;which&nbsp;already&nbsp;exists:&nbsp;'"&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"'");
<a name="line2485"></a><div class="linenumber">2485</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Can&nbsp;not&nbsp;create&nbsp;connection&nbsp;which&nbsp;already&nbsp;exists:&nbsp;'"&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"'"));
<a name="line2486"></a><div class="linenumber">2486</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2487"></a><div class="linenumber">2487</div><div style="width:4em;display:inline-block"></div>}
<a name="line2488"></a><div class="linenumber">2488</div><div style="width:0em;display:inline-block"></div>
<a name="line2489"></a><div class="linenumber">2489</div><div style="width:4em;display:inline-block"></div>//&nbsp;Set&nbsp;the&nbsp;connection&nbsp;structure&nbsp;with&nbsp;some&nbsp;default&nbsp;values
<a name="line2490"></a><div class="linenumber">2490</div><div style="width:4em;display:inline-block"></div>e.app[appName].connection[easyrtcid]&nbsp;=&nbsp;{
<a name="line2491"></a><div class="linenumber">2491</div><div style="width:6em;display:inline-block"></div>easyrtcid:&nbsp;easyrtcid,
<a name="line2492"></a><div class="linenumber">2492</div><div style="width:6em;display:inline-block"></div>socketId:&nbsp;socketId,
<a name="line2493"></a><div class="linenumber">2493</div><div style="width:6em;display:inline-block"></div>connectOn:&nbsp;Date.now(),
<a name="line2494"></a><div class="linenumber">2494</div><div style="width:6em;display:inline-block"></div>isAuthenticated:&nbsp;false,
<a name="line2495"></a><div class="linenumber">2495</div><div style="width:6em;display:inline-block"></div>userName:&nbsp;null,
<a name="line2496"></a><div class="linenumber">2496</div><div style="width:6em;display:inline-block"></div>credential:&nbsp;null,
<a name="line2497"></a><div class="linenumber">2497</div><div style="width:6em;display:inline-block"></div>field:&nbsp;{},
<a name="line2498"></a><div class="linenumber">2498</div><div style="width:6em;display:inline-block"></div>group:&nbsp;{},
<a name="line2499"></a><div class="linenumber">2499</div><div style="width:6em;display:inline-block"></div>presence:&nbsp;{
<a name="line2500"></a><div class="linenumber">2500</div><div style="width:8em;display:inline-block"></div>show:&nbsp;"chat",
<a name="line2501"></a><div class="linenumber">2501</div><div style="width:8em;display:inline-block"></div>status:&nbsp;null
<a name="line2502"></a><div class="linenumber">2502</div><div style="width:6em;display:inline-block"></div>},
<a name="line2503"></a><div class="linenumber">2503</div><div style="width:6em;display:inline-block"></div>room:&nbsp;{},
<a name="line2504"></a><div class="linenumber">2504</div><div style="width:6em;display:inline-block"></div>toApp:&nbsp;e.app[appName]
<a name="line2505"></a><div class="linenumber">2505</div><div style="width:4em;display:inline-block"></div>};
<a name="line2506"></a><div class="linenumber">2506</div><div style="width:0em;display:inline-block"></div>
<a name="line2507"></a><div class="linenumber">2507</div><div style="width:4em;display:inline-block"></div>//&nbsp;Initialize&nbsp;a&nbsp;new&nbsp;connection&nbsp;object
<a name="line2508"></a><div class="linenumber">2508</div><div style="width:4em;display:inline-block"></div>appObj.connection(easyrtcid,&nbsp;function(err,&nbsp;connectionObj)&nbsp;{
<a name="line2509"></a><div class="linenumber">2509</div><div style="width:6em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line2510"></a><div class="linenumber">2510</div><div style="width:8em;display:inline-block"></div>callback(err);
<a name="line2511"></a><div class="linenumber">2511</div><div style="width:8em;display:inline-block"></div>return;
<a name="line2512"></a><div class="linenumber">2512</div><div style="width:6em;display:inline-block"></div>}
<a name="line2513"></a><div class="linenumber">2513</div><div style="width:0em;display:inline-block"></div>
<a name="line2514"></a><div class="linenumber">2514</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;default&nbsp;connection&nbsp;fields
<a name="line2515"></a><div class="linenumber">2515</div><div style="width:6em;display:inline-block"></div>var&nbsp;connectionDefaultFieldObj&nbsp;=&nbsp;appObj.getOption("connectionDefaultFieldObj");
<a name="line2516"></a><div class="linenumber">2516</div><div style="width:6em;display:inline-block"></div>if&nbsp;(_.isObject(connectionDefaultFieldObj))&nbsp;{
<a name="line2517"></a><div class="linenumber">2517</div><div style="width:8em;display:inline-block"></div>for&nbsp;(var&nbsp;currentFieldName&nbsp;in&nbsp;connectionDefaultFieldObj)&nbsp;{
<a name="line2518"></a><div class="linenumber">2518</div><div style="width:10em;display:inline-block"></div>connectionObj.setField(
<a name="line2519"></a><div class="linenumber">2519</div><div style="width:14em;display:inline-block"></div>currentFieldName,
<a name="line2520"></a><div class="linenumber">2520</div><div style="width:14em;display:inline-block"></div>connectionDefaultFieldObj[currentFieldName].fieldValue,
<a name="line2521"></a><div class="linenumber">2521</div><div style="width:14em;display:inline-block"></div>connectionDefaultFieldObj[currentFieldName].fieldOption,
<a name="line2522"></a><div class="linenumber">2522</div><div style="width:14em;display:inline-block"></div>null
<a name="line2523"></a><div class="linenumber">2523</div><div style="width:14em;display:inline-block"></div>);
<a name="line2524"></a><div class="linenumber">2524</div><div style="width:8em;display:inline-block"></div>}
<a name="line2525"></a><div class="linenumber">2525</div><div style="width:6em;display:inline-block"></div>}
<a name="line2526"></a><div class="linenumber">2526</div><div style="width:0em;display:inline-block"></div>
<a name="line2527"></a><div class="linenumber">2527</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;connectionObj);
<a name="line2528"></a><div class="linenumber">2528</div><div style="width:4em;display:inline-block"></div>});
<a name="line2529"></a><div class="linenumber">2529</div><div style="width:2em;display:inline-block"></div>};
<a name="line2530"></a><div class="linenumber">2530</div><div style="width:0em;display:inline-block"></div>
<a name="line2531"></a><div class="linenumber">2531</div><div style="width:0em;display:inline-block"></div>
<a name="line2532"></a><div class="linenumber">2532</div><div style="width:2em;display:inline-block"></div>/**
<a name="line2533"></a><div class="linenumber">2533</div><div style="width:2em;display:inline-block"></div>*&nbsp;Counts&nbsp;how&nbsp;many&nbsp;occupants&nbsp;are&nbsp;in&nbsp;a&nbsp;room.
<a name="line2534"></a><div class="linenumber">2534</div><div style="width:2em;display:inline-block"></div>*
<a name="line2535"></a><div class="linenumber">2535</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line2536"></a><div class="linenumber">2536</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line2537"></a><div class="linenumber">2537</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;number=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;client&nbsp;count
<a name="line2538"></a><div class="linenumber">2538</div><div style="width:2em;display:inline-block"></div>*/
<a name="line2539"></a><div class="linenumber">2539</div><div style="width:2em;display:inline-block"></div>appObj.getRoomOccupantCount&nbsp;=&nbsp;function(roomName,&nbsp;callback)&nbsp;{
<a name="line2540"></a><div class="linenumber">2540</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line2541"></a><div class="linenumber">2541</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2542"></a><div class="linenumber">2542</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2543"></a><div class="linenumber">2543</div><div style="width:4em;display:inline-block"></div>}
<a name="line2544"></a><div class="linenumber">2544</div><div style="width:0em;display:inline-block"></div>
<a name="line2545"></a><div class="linenumber">2545</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;_.size(e.app[appName].room[roomName].clientList));
<a name="line2546"></a><div class="linenumber">2546</div><div style="width:2em;display:inline-block"></div>};
<a name="line2547"></a><div class="linenumber">2547</div><div style="width:0em;display:inline-block"></div>
<a name="line2548"></a><div class="linenumber">2548</div><div style="width:2em;display:inline-block"></div>/**
<a name="line2549"></a><div class="linenumber">2549</div><div style="width:2em;display:inline-block"></div>*&nbsp;Delete&nbsp;an&nbsp;existing&nbsp;room,&nbsp;providing&nbsp;the&nbsp;room&nbsp;is&nbsp;empty.
<a name="line2550"></a><div class="linenumber">2550</div><div style="width:2em;display:inline-block"></div>*
<a name="line2551"></a><div class="linenumber">2551</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line2552"></a><div class="linenumber">2552</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line2553"></a><div class="linenumber">2553</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;true&nbsp;if&nbsp;a&nbsp;room&nbsp;was&nbsp;deleted.
<a name="line2554"></a><div class="linenumber">2554</div><div style="width:2em;display:inline-block"></div>*/
<a name="line2555"></a><div class="linenumber">2555</div><div style="width:2em;display:inline-block"></div>appObj.deleteRoom&nbsp;=&nbsp;function(roomName,&nbsp;callback)&nbsp;{
<a name="line2556"></a><div class="linenumber">2556</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!roomName)&nbsp;{
<a name="line2557"></a><div class="linenumber">2557</div><div style="width:6em;display:inline-block"></div>var&nbsp;errorMsg&nbsp;=&nbsp;"Can't&nbsp;delete&nbsp;room&nbsp;with&nbsp;a&nbsp;null&nbsp;room&nbsp;name";
<a name="line2558"></a><div class="linenumber">2558</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning(errorMsg);
<a name="line2559"></a><div class="linenumber">2559</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning(errorMsg),&nbsp;false);
<a name="line2560"></a><div class="linenumber">2560</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2561"></a><div class="linenumber">2561</div><div style="width:4em;display:inline-block"></div>}
<a name="line2562"></a><div class="linenumber">2562</div><div style="width:0em;display:inline-block"></div>
<a name="line2563"></a><div class="linenumber">2563</div><div style="width:4em;display:inline-block"></div>//&nbsp;If&nbsp;room&nbsp;is&nbsp;already&nbsp;deleted&nbsp;or&nbsp;if&nbsp;it&nbsp;doesn't&nbsp;exist,&nbsp;report&nbsp;error
<a name="line2564"></a><div class="linenumber">2564</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line2565"></a><div class="linenumber">2565</div><div style="width:6em;display:inline-block"></div>var&nbsp;errorMsg&nbsp;=&nbsp;"Can't&nbsp;delete&nbsp;non-existing&nbsp;room:&nbsp;"&nbsp;+&nbsp;roomName;
<a name="line2566"></a><div class="linenumber">2566</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning(errorMsg);
<a name="line2567"></a><div class="linenumber">2567</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning(errorMsg),&nbsp;false);
<a name="line2568"></a><div class="linenumber">2568</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2569"></a><div class="linenumber">2569</div><div style="width:4em;display:inline-block"></div>}
<a name="line2570"></a><div class="linenumber">2570</div><div style="width:0em;display:inline-block"></div>
<a name="line2571"></a><div class="linenumber">2571</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!_.isEmpty(e.app[appName].room[roomName].clientList)){
<a name="line2572"></a><div class="linenumber">2572</div><div style="width:6em;display:inline-block"></div>var&nbsp;errorMsg&nbsp;=&nbsp;"Can't&nbsp;delete&nbsp;room&nbsp;"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"&nbsp;because&nbsp;it&nbsp;isn't&nbsp;empty";
<a name="line2573"></a><div class="linenumber">2573</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning(errorMsg);
<a name="line2574"></a><div class="linenumber">2574</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning(errorMsg),&nbsp;false);
<a name="line2575"></a><div class="linenumber">2575</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2576"></a><div class="linenumber">2576</div><div style="width:4em;display:inline-block"></div>}
<a name="line2577"></a><div class="linenumber">2577</div><div style="width:0em;display:inline-block"></div>
<a name="line2578"></a><div class="linenumber">2578</div><div style="width:4em;display:inline-block"></div>e.app[appName].room[roomName].deleted&nbsp;=&nbsp;true;
<a name="line2579"></a><div class="linenumber">2579</div><div style="width:0em;display:inline-block"></div>
<a name="line2580"></a><div class="linenumber">2580</div><div style="width:4em;display:inline-block"></div>delete&nbsp;e.app[appName].room[roomName];
<a name="line2581"></a><div class="linenumber">2581</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;true);
<a name="line2582"></a><div class="linenumber">2582</div><div style="width:2em;display:inline-block"></div>};
<a name="line2583"></a><div class="linenumber">2583</div><div style="width:0em;display:inline-block"></div>
<a name="line2584"></a><div class="linenumber">2584</div><div style="width:0em;display:inline-block"></div>
<a name="line2585"></a><div class="linenumber">2585</div><div style="width:2em;display:inline-block"></div>/**
<a name="line2586"></a><div class="linenumber">2586</div><div style="width:2em;display:inline-block"></div>*&nbsp;Creates&nbsp;a&nbsp;new&nbsp;room,&nbsp;sending&nbsp;the&nbsp;resulting&nbsp;room&nbsp;object&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.
<a name="line2587"></a><div class="linenumber">2587</div><div style="width:2em;display:inline-block"></div>*
<a name="line2588"></a><div class="linenumber">2588</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line2589"></a><div class="linenumber">2589</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line2590"></a><div class="linenumber">2590</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?object}&nbsp;&nbsp;&nbsp;options&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Options&nbsp;object&nbsp;with&nbsp;options&nbsp;to&nbsp;apply&nbsp;to&nbsp;the&nbsp;room.&nbsp;May&nbsp;be&nbsp;null.
<a name="line2591"></a><div class="linenumber">2591</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;EasyRTC&nbsp;room&nbsp;object&nbsp;(same&nbsp;as&nbsp;calling&nbsp;appObj.room(roomName))
<a name="line2592"></a><div class="linenumber">2592</div><div style="width:2em;display:inline-block"></div>*/
<a name="line2593"></a><div class="linenumber">2593</div><div style="width:2em;display:inline-block"></div>appObj.createRoom&nbsp;=&nbsp;function(roomName,&nbsp;options,&nbsp;callback)&nbsp;{
<a name="line2594"></a><div class="linenumber">2594</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!roomName&nbsp;||&nbsp;!appObj.getOption("roomNameRegExp").test(roomName))&nbsp;{
<a name="line2595"></a><div class="linenumber">2595</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;room&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line2596"></a><div class="linenumber">2596</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;create&nbsp;room&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2597"></a><div class="linenumber">2597</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2598"></a><div class="linenumber">2598</div><div style="width:4em;display:inline-block"></div>}
<a name="line2599"></a><div class="linenumber">2599</div><div style="width:4em;display:inline-block"></div>if&nbsp;(appObj.isRoomSync(roomName))&nbsp;{
<a name="line2600"></a><div class="linenumber">2600</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;room&nbsp;which&nbsp;already&nbsp;exists:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line2601"></a><div class="linenumber">2601</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;create&nbsp;room&nbsp;which&nbsp;already&nbsp;exists:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2602"></a><div class="linenumber">2602</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2603"></a><div class="linenumber">2603</div><div style="width:4em;display:inline-block"></div>}
<a name="line2604"></a><div class="linenumber">2604</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!_.isObject(options))&nbsp;{
<a name="line2605"></a><div class="linenumber">2605</div><div style="width:6em;display:inline-block"></div>options&nbsp;=&nbsp;{};
<a name="line2606"></a><div class="linenumber">2606</div><div style="width:4em;display:inline-block"></div>}
<a name="line2607"></a><div class="linenumber">2607</div><div style="width:4em;display:inline-block"></div>pub.util.logDebug("Creating&nbsp;room:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'&nbsp;with&nbsp;options:",&nbsp;options);
<a name="line2608"></a><div class="linenumber">2608</div><div style="width:0em;display:inline-block"></div>
<a name="line2609"></a><div class="linenumber">2609</div><div style="width:4em;display:inline-block"></div>e.app[appName].room[roomName]&nbsp;=&nbsp;{
<a name="line2610"></a><div class="linenumber">2610</div><div style="width:6em;display:inline-block"></div>roomName:&nbsp;roomName,
<a name="line2611"></a><div class="linenumber">2611</div><div style="width:6em;display:inline-block"></div>deleted:&nbsp;false,
<a name="line2612"></a><div class="linenumber">2612</div><div style="width:6em;display:inline-block"></div>clientList:&nbsp;{},
<a name="line2613"></a><div class="linenumber">2613</div><div style="width:6em;display:inline-block"></div>field:&nbsp;{},
<a name="line2614"></a><div class="linenumber">2614</div><div style="width:6em;display:inline-block"></div>option:&nbsp;{},
<a name="line2615"></a><div class="linenumber">2615</div><div style="width:6em;display:inline-block"></div>modifiedOn:&nbsp;Date.now()
<a name="line2616"></a><div class="linenumber">2616</div><div style="width:4em;display:inline-block"></div>};
<a name="line2617"></a><div class="linenumber">2617</div><div style="width:0em;display:inline-block"></div>
<a name="line2618"></a><div class="linenumber">2618</div><div style="width:4em;display:inline-block"></div>//&nbsp;Initialize&nbsp;a&nbsp;new&nbsp;room&nbsp;object
<a name="line2619"></a><div class="linenumber">2619</div><div style="width:4em;display:inline-block"></div>appObj.room(roomName,&nbsp;function(err,&nbsp;roomObj)&nbsp;{
<a name="line2620"></a><div class="linenumber">2620</div><div style="width:6em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line2621"></a><div class="linenumber">2621</div><div style="width:8em;display:inline-block"></div>callback(err);
<a name="line2622"></a><div class="linenumber">2622</div><div style="width:8em;display:inline-block"></div>return;
<a name="line2623"></a><div class="linenumber">2623</div><div style="width:6em;display:inline-block"></div>}
<a name="line2624"></a><div class="linenumber">2624</div><div style="width:0em;display:inline-block"></div>
<a name="line2625"></a><div class="linenumber">2625</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;all&nbsp;options&nbsp;in&nbsp;options&nbsp;object.&nbsp;If&nbsp;any&nbsp;fail,&nbsp;an&nbsp;error&nbsp;will&nbsp;be&nbsp;sent&nbsp;to&nbsp;the&nbsp;callback.
<a name="line2626"></a><div class="linenumber">2626</div><div style="width:6em;display:inline-block"></div>async.each(Object.keys(options),&nbsp;function(currentOptionName,&nbsp;asyncCallback)&nbsp;{
<a name="line2627"></a><div class="linenumber">2627</div><div style="width:8em;display:inline-block"></div>roomObj.setOption(currentOptionName,&nbsp;options[currentOptionName]);
<a name="line2628"></a><div class="linenumber">2628</div><div style="width:8em;display:inline-block"></div>asyncCallback(null);
<a name="line2629"></a><div class="linenumber">2629</div><div style="width:6em;display:inline-block"></div>},
<a name="line2630"></a><div class="linenumber">2630</div><div style="width:10em;display:inline-block"></div>function(err)&nbsp;{
<a name="line2631"></a><div class="linenumber">2631</div><div style="width:12em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line2632"></a><div class="linenumber">2632</div><div style="width:14em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationError("Could&nbsp;not&nbsp;set&nbsp;options&nbsp;when&nbsp;creating&nbsp;room:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'",&nbsp;err));
<a name="line2633"></a><div class="linenumber">2633</div><div style="width:14em;display:inline-block"></div>return;
<a name="line2634"></a><div class="linenumber">2634</div><div style="width:12em;display:inline-block"></div>}
<a name="line2635"></a><div class="linenumber">2635</div><div style="width:0em;display:inline-block"></div>
<a name="line2636"></a><div class="linenumber">2636</div><div style="width:12em;display:inline-block"></div>//&nbsp;Set&nbsp;default&nbsp;room&nbsp;fields
<a name="line2637"></a><div class="linenumber">2637</div><div style="width:12em;display:inline-block"></div>var&nbsp;roomDefaultFieldObj&nbsp;=&nbsp;roomObj.getOption("roomDefaultFieldObj");
<a name="line2638"></a><div class="linenumber">2638</div><div style="width:0em;display:inline-block"></div>
<a name="line2639"></a><div class="linenumber">2639</div><div style="width:12em;display:inline-block"></div>if&nbsp;(_.isObject(roomDefaultFieldObj))&nbsp;{
<a name="line2640"></a><div class="linenumber">2640</div><div style="width:14em;display:inline-block"></div>for&nbsp;(var&nbsp;currentFieldName&nbsp;in&nbsp;roomDefaultFieldObj)&nbsp;{
<a name="line2641"></a><div class="linenumber">2641</div><div style="width:16em;display:inline-block"></div>roomObj.setField(
<a name="line2642"></a><div class="linenumber">2642</div><div style="width:20em;display:inline-block"></div>currentFieldName,
<a name="line2643"></a><div class="linenumber">2643</div><div style="width:20em;display:inline-block"></div>roomDefaultFieldObj[currentFieldName].fieldValue,
<a name="line2644"></a><div class="linenumber">2644</div><div style="width:20em;display:inline-block"></div>roomDefaultFieldObj[currentFieldName].fieldOption,
<a name="line2645"></a><div class="linenumber">2645</div><div style="width:20em;display:inline-block"></div>null
<a name="line2646"></a><div class="linenumber">2646</div><div style="width:20em;display:inline-block"></div>);
<a name="line2647"></a><div class="linenumber">2647</div><div style="width:14em;display:inline-block"></div>}
<a name="line2648"></a><div class="linenumber">2648</div><div style="width:12em;display:inline-block"></div>}
<a name="line2649"></a><div class="linenumber">2649</div><div style="width:0em;display:inline-block"></div>
<a name="line2650"></a><div class="linenumber">2650</div><div style="width:12em;display:inline-block"></div>//&nbsp;Return&nbsp;room&nbsp;object&nbsp;to&nbsp;callback
<a name="line2651"></a><div class="linenumber">2651</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;roomObj);
<a name="line2652"></a><div class="linenumber">2652</div><div style="width:10em;display:inline-block"></div>});
<a name="line2653"></a><div class="linenumber">2653</div><div style="width:4em;display:inline-block"></div>});
<a name="line2654"></a><div class="linenumber">2654</div><div style="width:2em;display:inline-block"></div>};
<a name="line2655"></a><div class="linenumber">2655</div><div style="width:0em;display:inline-block"></div>
<a name="line2656"></a><div class="linenumber">2656</div><div style="width:0em;display:inline-block"></div>
<a name="line2657"></a><div class="linenumber">2657</div><div style="width:2em;display:inline-block"></div>/**
<a name="line2658"></a><div class="linenumber">2658</div><div style="width:2em;display:inline-block"></div>*&nbsp;Creates&nbsp;a&nbsp;new&nbsp;session&nbsp;with&nbsp;a&nbsp;provided&nbsp;easyrtcsid
<a name="line2659"></a><div class="linenumber">2659</div><div style="width:2em;display:inline-block"></div>*
<a name="line2660"></a><div class="linenumber">2660</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line2661"></a><div class="linenumber">2661</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcsid&nbsp;&nbsp;EasyRTC&nbsp;Session&nbsp;Identifier.&nbsp;Must&nbsp;be&nbsp;formatted&nbsp;according&nbsp;to&nbsp;"easyrtcsidRegExp"&nbsp;option.
<a name="line2662"></a><div class="linenumber">2662</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;EasyRTC&nbsp;session&nbsp;object&nbsp;(same&nbsp;as&nbsp;calling&nbsp;session(easyrtcsid))
<a name="line2663"></a><div class="linenumber">2663</div><div style="width:2em;display:inline-block"></div>*/
<a name="line2664"></a><div class="linenumber">2664</div><div style="width:2em;display:inline-block"></div>appObj.createSession&nbsp;=&nbsp;function(easyrtcsid,&nbsp;callback)&nbsp;{
<a name="line2665"></a><div class="linenumber">2665</div><div style="width:4em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;appObj.getAppName()&nbsp;+&nbsp;"]&nbsp;Creating&nbsp;session&nbsp;["&nbsp;+&nbsp;easyrtcsid&nbsp;+&nbsp;"]");
<a name="line2666"></a><div class="linenumber">2666</div><div style="width:0em;display:inline-block"></div>
<a name="line2667"></a><div class="linenumber">2667</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!easyrtcsid&nbsp;||&nbsp;!appObj.getOption("easyrtcsidRegExp").test(easyrtcsid))&nbsp;{
<a name="line2668"></a><div class="linenumber">2668</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;session&nbsp;with&nbsp;improper&nbsp;name&nbsp;["&nbsp;+&nbsp;easyrtcsid&nbsp;+&nbsp;"]");
<a name="line2669"></a><div class="linenumber">2669</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Can&nbsp;not&nbsp;create&nbsp;session&nbsp;with&nbsp;improper&nbsp;name&nbsp;["&nbsp;+&nbsp;easyrtcsid&nbsp;+&nbsp;"]"));
<a name="line2670"></a><div class="linenumber">2670</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2671"></a><div class="linenumber">2671</div><div style="width:4em;display:inline-block"></div>}
<a name="line2672"></a><div class="linenumber">2672</div><div style="width:0em;display:inline-block"></div>
<a name="line2673"></a><div class="linenumber">2673</div><div style="width:4em;display:inline-block"></div>if&nbsp;(e.app[appName].session[easyrtcsid])&nbsp;{
<a name="line2674"></a><div class="linenumber">2674</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;session&nbsp;which&nbsp;already&nbsp;exists&nbsp;["&nbsp;+&nbsp;easyrtcsid&nbsp;+&nbsp;"]");
<a name="line2675"></a><div class="linenumber">2675</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Can&nbsp;not&nbsp;create&nbsp;session&nbsp;which&nbsp;already&nbsp;exists&nbsp;["&nbsp;+&nbsp;easyrtcsid&nbsp;+&nbsp;"]"));
<a name="line2676"></a><div class="linenumber">2676</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2677"></a><div class="linenumber">2677</div><div style="width:4em;display:inline-block"></div>}
<a name="line2678"></a><div class="linenumber">2678</div><div style="width:0em;display:inline-block"></div>
<a name="line2679"></a><div class="linenumber">2679</div><div style="width:4em;display:inline-block"></div>//&nbsp;Set&nbsp;the&nbsp;session&nbsp;structure&nbsp;with&nbsp;some&nbsp;default&nbsp;values
<a name="line2680"></a><div class="linenumber">2680</div><div style="width:4em;display:inline-block"></div>e.app[appName].session[easyrtcsid]&nbsp;=&nbsp;{
<a name="line2681"></a><div class="linenumber">2681</div><div style="width:6em;display:inline-block"></div>"easyrtcsid":&nbsp;easyrtcsid,
<a name="line2682"></a><div class="linenumber">2682</div><div style="width:6em;display:inline-block"></div>"startOn":&nbsp;Date.now(),
<a name="line2683"></a><div class="linenumber">2683</div><div style="width:6em;display:inline-block"></div>"toConnection":{},
<a name="line2684"></a><div class="linenumber">2684</div><div style="width:6em;display:inline-block"></div>"field":&nbsp;{}
<a name="line2685"></a><div class="linenumber">2685</div><div style="width:4em;display:inline-block"></div>};
<a name="line2686"></a><div class="linenumber">2686</div><div style="width:0em;display:inline-block"></div>
<a name="line2687"></a><div class="linenumber">2687</div><div style="width:4em;display:inline-block"></div>appObj.session(easyrtcsid,&nbsp;callback);
<a name="line2688"></a><div class="linenumber">2688</div><div style="width:2em;display:inline-block"></div>};
<a name="line2689"></a><div class="linenumber">2689</div><div style="width:0em;display:inline-block"></div>
<a name="line2690"></a><div class="linenumber">2690</div><div style="width:0em;display:inline-block"></div>
<a name="line2691"></a><div class="linenumber">2691</div><div style="width:2em;display:inline-block"></div>/**
<a name="line2692"></a><div class="linenumber">2692</div><div style="width:2em;display:inline-block"></div>*&nbsp;Checks&nbsp;if&nbsp;a&nbsp;provided&nbsp;room&nbsp;is&nbsp;defined.&nbsp;The&nbsp;callback&nbsp;returns&nbsp;a&nbsp;boolean&nbsp;if&nbsp;room&nbsp;is&nbsp;defined.
<a name="line2693"></a><div class="linenumber">2693</div><div style="width:2em;display:inline-block"></div>*
<a name="line2694"></a><div class="linenumber">2694</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line2695"></a><div class="linenumber">2695</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line2696"></a><div class="linenumber">2696</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;boolean)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;boolean&nbsp;of&nbsp;whether&nbsp;room&nbsp;is&nbsp;defined.
<a name="line2697"></a><div class="linenumber">2697</div><div style="width:2em;display:inline-block"></div>*/
<a name="line2698"></a><div class="linenumber">2698</div><div style="width:2em;display:inline-block"></div>appObj.isRoom&nbsp;=&nbsp;function(roomName,&nbsp;callback)&nbsp;{
<a name="line2699"></a><div class="linenumber">2699</div><div style="width:4em;display:inline-block"></div>callback(null,((e.app[appName]&nbsp;&amp;&amp;&nbsp;e.app[appName].room[roomName]&nbsp;&amp;&amp;&nbsp;!e.app[appName].room[roomName].deleted)&nbsp;?&nbsp;true&nbsp;:&nbsp;false));
<a name="line2700"></a><div class="linenumber">2700</div><div style="width:2em;display:inline-block"></div>};
<a name="line2701"></a><div class="linenumber">2701</div><div style="width:0em;display:inline-block"></div>
<a name="line2702"></a><div class="linenumber">2702</div><div style="width:0em;display:inline-block"></div>
<a name="line2703"></a><div class="linenumber">2703</div><div style="width:2em;display:inline-block"></div>/**
<a name="line2704"></a><div class="linenumber">2704</div><div style="width:2em;display:inline-block"></div>*&nbsp;Checks&nbsp;if&nbsp;a&nbsp;provided&nbsp;room&nbsp;is&nbsp;defined.&nbsp;This&nbsp;is&nbsp;a&nbsp;synchronous&nbsp;function,&nbsp;thus&nbsp;may&nbsp;not&nbsp;be&nbsp;available&nbsp;in&nbsp;custom&nbsp;cases&nbsp;where&nbsp;room&nbsp;state&nbsp;is&nbsp;not&nbsp;kept&nbsp;in&nbsp;memory.
<a name="line2705"></a><div class="linenumber">2705</div><div style="width:2em;display:inline-block"></div>*
<a name="line2706"></a><div class="linenumber">2706</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line2707"></a><div class="linenumber">2707</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line2708"></a><div class="linenumber">2708</div><div style="width:2em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Boolean}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;boolean.&nbsp;True&nbsp;if&nbsp;room&nbsp;is&nbsp;defined.
<a name="line2709"></a><div class="linenumber">2709</div><div style="width:2em;display:inline-block"></div>*/
<a name="line2710"></a><div class="linenumber">2710</div><div style="width:2em;display:inline-block"></div>appObj.isRoomSync&nbsp;=&nbsp;function(roomName)&nbsp;{
<a name="line2711"></a><div class="linenumber">2711</div><div style="width:4em;display:inline-block"></div>return&nbsp;((e.app[appName]&nbsp;&amp;&amp;&nbsp;e.app[appName].room[roomName]&nbsp;&amp;&amp;&nbsp;!e.app[appName].room[roomName].deleted)&nbsp;?&nbsp;true&nbsp;:&nbsp;false);
<a name="line2712"></a><div class="linenumber">2712</div><div style="width:2em;display:inline-block"></div>};
<a name="line2713"></a><div class="linenumber">2713</div><div style="width:0em;display:inline-block"></div>
<a name="line2714"></a><div class="linenumber">2714</div><div style="width:0em;display:inline-block"></div>
<a name="line2715"></a><div class="linenumber">2715</div><div style="width:2em;display:inline-block"></div>/**
<a name="line2716"></a><div class="linenumber">2716</div><div style="width:2em;display:inline-block"></div>*&nbsp;Checks&nbsp;if&nbsp;a&nbsp;provided&nbsp;session&nbsp;is&nbsp;defined.&nbsp;The&nbsp;callback&nbsp;returns&nbsp;a&nbsp;boolean&nbsp;if&nbsp;session&nbsp;is&nbsp;defined
<a name="line2717"></a><div class="linenumber">2717</div><div style="width:2em;display:inline-block"></div>*
<a name="line2718"></a><div class="linenumber">2718</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line2719"></a><div class="linenumber">2719</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcsid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;session&nbsp;identifier
<a name="line2720"></a><div class="linenumber">2720</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;boolean)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;boolean&nbsp;of&nbsp;whether&nbsp;session&nbsp;is&nbsp;defined.
<a name="line2721"></a><div class="linenumber">2721</div><div style="width:2em;display:inline-block"></div>*/
<a name="line2722"></a><div class="linenumber">2722</div><div style="width:2em;display:inline-block"></div>appObj.isSession&nbsp;=&nbsp;function(easyrtcsid,&nbsp;callback)&nbsp;{
<a name="line2723"></a><div class="linenumber">2723</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;(e.app[appName].session[easyrtcsid]&nbsp;?&nbsp;true&nbsp;:&nbsp;false));
<a name="line2724"></a><div class="linenumber">2724</div><div style="width:2em;display:inline-block"></div>};
<a name="line2725"></a><div class="linenumber">2725</div><div style="width:0em;display:inline-block"></div>
<a name="line2726"></a><div class="linenumber">2726</div><div style="width:0em;display:inline-block"></div>
<a name="line2727"></a><div class="linenumber">2727</div><div style="width:2em;display:inline-block"></div>/**
<a name="line2728"></a><div class="linenumber">2728</div><div style="width:2em;display:inline-block"></div>*&nbsp;NOT&nbsp;YET&nbsp;IMPLEMENTED&nbsp;-&nbsp;Gets&nbsp;group&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;group&nbsp;name.&nbsp;Returns&nbsp;null&nbsp;if&nbsp;group&nbsp;not&nbsp;found.
<a name="line2729"></a><div class="linenumber">2729</div><div style="width:2em;display:inline-block"></div>*&nbsp;The&nbsp;returned&nbsp;group&nbsp;object&nbsp;includes&nbsp;functions&nbsp;for&nbsp;managing&nbsp;group&nbsp;fields.
<a name="line2730"></a><div class="linenumber">2730</div><div style="width:2em;display:inline-block"></div>*
<a name="line2731"></a><div class="linenumber">2731</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line2732"></a><div class="linenumber">2732</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;groupName&nbsp;&nbsp;&nbsp;Group&nbsp;name
<a name="line2733"></a><div class="linenumber">2733</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;EasyRTC&nbsp;group&nbsp;object.
<a name="line2734"></a><div class="linenumber">2734</div><div style="width:2em;display:inline-block"></div>*/
<a name="line2735"></a><div class="linenumber">2735</div><div style="width:2em;display:inline-block"></div>appObj.group&nbsp;=&nbsp;function(groupName,&nbsp;callback)&nbsp;{
<a name="line2736"></a><div class="linenumber">2736</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!e.app[appName].group[groupName])&nbsp;{
<a name="line2737"></a><div class="linenumber">2737</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;group&nbsp;name:&nbsp;'"&nbsp;+&nbsp;groupName&nbsp;+&nbsp;"'");
<a name="line2738"></a><div class="linenumber">2738</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;group&nbsp;name:&nbsp;'"&nbsp;+&nbsp;groupName&nbsp;+&nbsp;"'"));
<a name="line2739"></a><div class="linenumber">2739</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2740"></a><div class="linenumber">2740</div><div style="width:4em;display:inline-block"></div>}
<a name="line2741"></a><div class="linenumber">2741</div><div style="width:0em;display:inline-block"></div>
<a name="line2742"></a><div class="linenumber">2742</div><div style="width:4em;display:inline-block"></div>var&nbsp;groupObj&nbsp;=&nbsp;{};
<a name="line2743"></a><div class="linenumber">2743</div><div style="width:0em;display:inline-block"></div>
<a name="line2744"></a><div class="linenumber">2744</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2745"></a><div class="linenumber">2745</div><div style="width:4em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;event&nbsp;functions
<a name="line2746"></a><div class="linenumber">2746</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2747"></a><div class="linenumber">2747</div><div style="width:4em;display:inline-block"></div>groupObj.events&nbsp;=&nbsp;pub.events;
<a name="line2748"></a><div class="linenumber">2748</div><div style="width:0em;display:inline-block"></div>
<a name="line2749"></a><div class="linenumber">2749</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2750"></a><div class="linenumber">2750</div><div style="width:4em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;utility&nbsp;functions
<a name="line2751"></a><div class="linenumber">2751</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2752"></a><div class="linenumber">2752</div><div style="width:4em;display:inline-block"></div>groupObj.util&nbsp;=&nbsp;pub.util;
<a name="line2753"></a><div class="linenumber">2753</div><div style="width:0em;display:inline-block"></div>
<a name="line2754"></a><div class="linenumber">2754</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2755"></a><div class="linenumber">2755</div><div style="width:4em;display:inline-block"></div>*&nbsp;NOT&nbsp;YET&nbsp;IMPLEMENTED&nbsp;-&nbsp;Returns&nbsp;an&nbsp;array&nbsp;of&nbsp;all&nbsp;connected&nbsp;clients&nbsp;within&nbsp;the&nbsp;room.
<a name="line2756"></a><div class="linenumber">2756</div><div style="width:4em;display:inline-block"></div>*
<a name="line2757"></a><div class="linenumber">2757</div><div style="width:4em;display:inline-block"></div>*&nbsp;@ignore
<a name="line2758"></a><div class="linenumber">2758</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;{function(?Error,&nbsp;Array.&lt;string&gt;)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;containing&nbsp;all&nbsp;easyrtcids.
<a name="line2759"></a><div class="linenumber">2759</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2760"></a><div class="linenumber">2760</div><div style="width:4em;display:inline-block"></div>groupObj.getConnections&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line2761"></a><div class="linenumber">2761</div><div style="width:6em;display:inline-block"></div>var&nbsp;connectedEasyrtcidArray&nbsp;=&nbsp;[];
<a name="line2762"></a><div class="linenumber">2762</div><div style="width:6em;display:inline-block"></div>for&nbsp;(var&nbsp;key&nbsp;in&nbsp;e.app[appName].group[groupName].clientList)&nbsp;{
<a name="line2763"></a><div class="linenumber">2763</div><div style="width:8em;display:inline-block"></div>connectedEasyrtcidArray.push(key);
<a name="line2764"></a><div class="linenumber">2764</div><div style="width:6em;display:inline-block"></div>}
<a name="line2765"></a><div class="linenumber">2765</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;connectedEasyrtcidArray);
<a name="line2766"></a><div class="linenumber">2766</div><div style="width:4em;display:inline-block"></div>};
<a name="line2767"></a><div class="linenumber">2767</div><div style="width:0em;display:inline-block"></div>
<a name="line2768"></a><div class="linenumber">2768</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;groupObj);
<a name="line2769"></a><div class="linenumber">2769</div><div style="width:2em;display:inline-block"></div>};
<a name="line2770"></a><div class="linenumber">2770</div><div style="width:0em;display:inline-block"></div>
<a name="line2771"></a><div class="linenumber">2771</div><div style="width:0em;display:inline-block"></div>
<a name="line2772"></a><div class="linenumber">2772</div><div style="width:2em;display:inline-block"></div>/**
<a name="line2773"></a><div class="linenumber">2773</div><div style="width:2em;display:inline-block"></div>*&nbsp;Gets&nbsp;room&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;room&nbsp;name.&nbsp;Returns&nbsp;null&nbsp;if&nbsp;room&nbsp;not&nbsp;found.
<a name="line2774"></a><div class="linenumber">2774</div><div style="width:2em;display:inline-block"></div>*&nbsp;The&nbsp;returned&nbsp;room&nbsp;object&nbsp;includes&nbsp;functions&nbsp;for&nbsp;managing&nbsp;room&nbsp;fields.
<a name="line2775"></a><div class="linenumber">2775</div><div style="width:2em;display:inline-block"></div>*
<a name="line2776"></a><div class="linenumber">2776</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line2777"></a><div class="linenumber">2777</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line2778"></a><div class="linenumber">2778</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;EasyRTC&nbsp;room&nbsp;object.
<a name="line2779"></a><div class="linenumber">2779</div><div style="width:2em;display:inline-block"></div>*/
<a name="line2780"></a><div class="linenumber">2780</div><div style="width:2em;display:inline-block"></div>appObj.room&nbsp;=&nbsp;function(roomName,&nbsp;callback)&nbsp;{
<a name="line2781"></a><div class="linenumber">2781</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line2782"></a><div class="linenumber">2782</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line2783"></a><div class="linenumber">2783</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2784"></a><div class="linenumber">2784</div><div style="width:6em;display:inline-block"></div>return;
<a name="line2785"></a><div class="linenumber">2785</div><div style="width:4em;display:inline-block"></div>}
<a name="line2786"></a><div class="linenumber">2786</div><div style="width:0em;display:inline-block"></div>
<a name="line2787"></a><div class="linenumber">2787</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2788"></a><div class="linenumber">2788</div><div style="width:4em;display:inline-block"></div>*&nbsp;EasyRTC&nbsp;Room&nbsp;Object.&nbsp;Contains&nbsp;methods&nbsp;for&nbsp;handling&nbsp;a&nbsp;specific&nbsp;room&nbsp;including&nbsp;determining&nbsp;which&nbsp;connections&nbsp;have&nbsp;joined.
<a name="line2789"></a><div class="linenumber">2789</div><div style="width:4em;display:inline-block"></div>*
<a name="line2790"></a><div class="linenumber">2790</div><div style="width:4em;display:inline-block"></div>*&nbsp;@class&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;roomObj
<a name="line2791"></a><div class="linenumber">2791</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line2792"></a><div class="linenumber">2792</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2793"></a><div class="linenumber">2793</div><div style="width:4em;display:inline-block"></div>var&nbsp;roomObj&nbsp;=&nbsp;{};
<a name="line2794"></a><div class="linenumber">2794</div><div style="width:0em;display:inline-block"></div>
<a name="line2795"></a><div class="linenumber">2795</div><div style="width:0em;display:inline-block"></div>
<a name="line2796"></a><div class="linenumber">2796</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2797"></a><div class="linenumber">2797</div><div style="width:4em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;event&nbsp;functions
<a name="line2798"></a><div class="linenumber">2798</div><div style="width:4em;display:inline-block"></div>*
<a name="line2799"></a><div class="linenumber">2799</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line2800"></a><div class="linenumber">2800</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2801"></a><div class="linenumber">2801</div><div style="width:4em;display:inline-block"></div>roomObj.events&nbsp;=&nbsp;pub.events;
<a name="line2802"></a><div class="linenumber">2802</div><div style="width:0em;display:inline-block"></div>
<a name="line2803"></a><div class="linenumber">2803</div><div style="width:0em;display:inline-block"></div>
<a name="line2804"></a><div class="linenumber">2804</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2805"></a><div class="linenumber">2805</div><div style="width:4em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;utility&nbsp;functions
<a name="line2806"></a><div class="linenumber">2806</div><div style="width:4em;display:inline-block"></div>*
<a name="line2807"></a><div class="linenumber">2807</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line2808"></a><div class="linenumber">2808</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2809"></a><div class="linenumber">2809</div><div style="width:4em;display:inline-block"></div>roomObj.util&nbsp;=&nbsp;pub.util;
<a name="line2810"></a><div class="linenumber">2810</div><div style="width:0em;display:inline-block"></div>
<a name="line2811"></a><div class="linenumber">2811</div><div style="width:0em;display:inline-block"></div>
<a name="line2812"></a><div class="linenumber">2812</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2813"></a><div class="linenumber">2813</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;application&nbsp;object&nbsp;to&nbsp;which&nbsp;the&nbsp;room&nbsp;belongs.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line2814"></a><div class="linenumber">2814</div><div style="width:4em;display:inline-block"></div>*
<a name="line2815"></a><div class="linenumber">2815</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line2816"></a><div class="linenumber">2816</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;application&nbsp;object
<a name="line2817"></a><div class="linenumber">2817</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2818"></a><div class="linenumber">2818</div><div style="width:4em;display:inline-block"></div>roomObj.getApp&nbsp;=&nbsp;function()&nbsp;{
<a name="line2819"></a><div class="linenumber">2819</div><div style="width:6em;display:inline-block"></div>return&nbsp;appObj;
<a name="line2820"></a><div class="linenumber">2820</div><div style="width:4em;display:inline-block"></div>};
<a name="line2821"></a><div class="linenumber">2821</div><div style="width:0em;display:inline-block"></div>
<a name="line2822"></a><div class="linenumber">2822</div><div style="width:0em;display:inline-block"></div>
<a name="line2823"></a><div class="linenumber">2823</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2824"></a><div class="linenumber">2824</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;application&nbsp;name&nbsp;for&nbsp;the&nbsp;application&nbsp;to&nbsp;which&nbsp;the&nbsp;room&nbsp;belongs.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line2825"></a><div class="linenumber">2825</div><div style="width:4em;display:inline-block"></div>*
<a name="line2826"></a><div class="linenumber">2826</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line2827"></a><div class="linenumber">2827</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;application&nbsp;name
<a name="line2828"></a><div class="linenumber">2828</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2829"></a><div class="linenumber">2829</div><div style="width:4em;display:inline-block"></div>roomObj.getAppName&nbsp;=&nbsp;function()&nbsp;{
<a name="line2830"></a><div class="linenumber">2830</div><div style="width:6em;display:inline-block"></div>return&nbsp;appName;
<a name="line2831"></a><div class="linenumber">2831</div><div style="width:4em;display:inline-block"></div>};
<a name="line2832"></a><div class="linenumber">2832</div><div style="width:0em;display:inline-block"></div>
<a name="line2833"></a><div class="linenumber">2833</div><div style="width:0em;display:inline-block"></div>
<a name="line2834"></a><div class="linenumber">2834</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2835"></a><div class="linenumber">2835</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;room&nbsp;name&nbsp;for&nbsp;the&nbsp;current&nbsp;room.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line2836"></a><div class="linenumber">2836</div><div style="width:4em;display:inline-block"></div>*
<a name="line2837"></a><div class="linenumber">2837</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line2838"></a><div class="linenumber">2838</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;room&nbsp;name
<a name="line2839"></a><div class="linenumber">2839</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2840"></a><div class="linenumber">2840</div><div style="width:4em;display:inline-block"></div>roomObj.getRoomName&nbsp;=&nbsp;function()&nbsp;{
<a name="line2841"></a><div class="linenumber">2841</div><div style="width:6em;display:inline-block"></div>return&nbsp;roomName;
<a name="line2842"></a><div class="linenumber">2842</div><div style="width:4em;display:inline-block"></div>};
<a name="line2843"></a><div class="linenumber">2843</div><div style="width:0em;display:inline-block"></div>
<a name="line2844"></a><div class="linenumber">2844</div><div style="width:0em;display:inline-block"></div>
<a name="line2845"></a><div class="linenumber">2845</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2846"></a><div class="linenumber">2846</div><div style="width:4em;display:inline-block"></div>*&nbsp;INCOMPLETE:&nbsp;Emits&nbsp;a&nbsp;roomData&nbsp;message&nbsp;containing&nbsp;fields&nbsp;to&nbsp;all&nbsp;connections&nbsp;in&nbsp;the&nbsp;current&nbsp;room.&nbsp;This&nbsp;is&nbsp;meant&nbsp;to&nbsp;be&nbsp;called&nbsp;after&nbsp;a&nbsp;room&nbsp;field&nbsp;has&nbsp;been&nbsp;set&nbsp;or&nbsp;updated.&nbsp;
<a name="line2847"></a><div class="linenumber">2847</div><div style="width:4em;display:inline-block"></div>*&nbsp;@ignore&nbsp;
<a name="line2848"></a><div class="linenumber">2848</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2849"></a><div class="linenumber">2849</div><div style="width:4em;display:inline-block"></div>roomObj.emitRoomDataFieldUpdate&nbsp;=&nbsp;function(skipEasyrtcid,&nbsp;next)&nbsp;{
<a name="line2850"></a><div class="linenumber">2850</div><div style="width:6em;display:inline-block"></div>roomObj.getFields(true,&nbsp;function(err,&nbsp;fieldObj)&nbsp;{
<a name="line2851"></a><div class="linenumber">2851</div><div style="width:8em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line2852"></a><div class="linenumber">2852</div><div style="width:10em;display:inline-block"></div>next(err);
<a name="line2853"></a><div class="linenumber">2853</div><div style="width:10em;display:inline-block"></div>return;
<a name="line2854"></a><div class="linenumber">2854</div><div style="width:8em;display:inline-block"></div>}
<a name="line2855"></a><div class="linenumber">2855</div><div style="width:8em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line2856"></a><div class="linenumber">2856</div><div style="width:10em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line2857"></a><div class="linenumber">2857</div><div style="width:10em;display:inline-block"></div>next(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2858"></a><div class="linenumber">2858</div><div style="width:10em;display:inline-block"></div>return;
<a name="line2859"></a><div class="linenumber">2859</div><div style="width:8em;display:inline-block"></div>}
<a name="line2860"></a><div class="linenumber">2860</div><div style="width:0em;display:inline-block"></div>
<a name="line2861"></a><div class="linenumber">2861</div><div style="width:8em;display:inline-block"></div>var&nbsp;outgoingMsg&nbsp;=&nbsp;{"msgData":&nbsp;{"roomData":&nbsp;{}}};
<a name="line2862"></a><div class="linenumber">2862</div><div style="width:8em;display:inline-block"></div>outgoingMsg.msgData.roomData[roomName]&nbsp;=&nbsp;{
<a name="line2863"></a><div class="linenumber">2863</div><div style="width:10em;display:inline-block"></div>"roomName":&nbsp;roomName,
<a name="line2864"></a><div class="linenumber">2864</div><div style="width:10em;display:inline-block"></div>"roomStatus":&nbsp;"update"
<a name="line2865"></a><div class="linenumber">2865</div><div style="width:8em;display:inline-block"></div>};
<a name="line2866"></a><div class="linenumber">2866</div><div style="width:8em;display:inline-block"></div>outgoingMsg.msgData.roomData[roomName].field&nbsp;=&nbsp;fieldObj;
<a name="line2867"></a><div class="linenumber">2867</div><div style="width:0em;display:inline-block"></div>
<a name="line2868"></a><div class="linenumber">2868</div><div style="width:8em;display:inline-block"></div>async.each(
<a name="line2869"></a><div class="linenumber">2869</div><div style="width:12em;display:inline-block"></div>Object.keys(e.app[appName].room[roomName].clientList),
<a name="line2870"></a><div class="linenumber">2870</div><div style="width:12em;display:inline-block"></div>function(currentEasyrtcid,&nbsp;asyncCallback)&nbsp;{
<a name="line2871"></a><div class="linenumber">2871</div><div style="width:0em;display:inline-block"></div>
<a name="line2872"></a><div class="linenumber">2872</div><div style="width:14em;display:inline-block"></div>//&nbsp;Skip&nbsp;a&nbsp;given&nbsp;easyrtcid?
<a name="line2873"></a><div class="linenumber">2873</div><div style="width:14em;display:inline-block"></div>if&nbsp;(skipEasyrtcid&nbsp;&amp;&amp;&nbsp;(skipEasyrtcid&nbsp;==&nbsp;currentEasyrtcid))&nbsp;{
<a name="line2874"></a><div class="linenumber">2874</div><div style="width:16em;display:inline-block"></div>asyncCallback(null);
<a name="line2875"></a><div class="linenumber">2875</div><div style="width:16em;display:inline-block"></div>return;
<a name="line2876"></a><div class="linenumber">2876</div><div style="width:14em;display:inline-block"></div>}
<a name="line2877"></a><div class="linenumber">2877</div><div style="width:0em;display:inline-block"></div>
<a name="line2878"></a><div class="linenumber">2878</div><div style="width:14em;display:inline-block"></div>//&nbsp;Retrieve&nbsp;a&nbsp;connection&nbsp;object,&nbsp;then&nbsp;send&nbsp;the&nbsp;roomData&nbsp;message.
<a name="line2879"></a><div class="linenumber">2879</div><div style="width:14em;display:inline-block"></div>appObj.connection(currentEasyrtcid,&nbsp;function(err,&nbsp;targetConnectionObj)&nbsp;{
<a name="line2880"></a><div class="linenumber">2880</div><div style="width:16em;display:inline-block"></div>if&nbsp;(err&nbsp;||&nbsp;!_.isObject(targetConnectionObj))&nbsp;{
<a name="line2881"></a><div class="linenumber">2881</div><div style="width:18em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;currentEasyrtcid&nbsp;+&nbsp;"]&nbsp;Could&nbsp;not&nbsp;get&nbsp;connection&nbsp;object&nbsp;to&nbsp;send&nbsp;room&nbsp;data&nbsp;field&nbsp;update.&nbsp;Client&nbsp;may&nbsp;have&nbsp;disconnected.");
<a name="line2882"></a><div class="linenumber">2882</div><div style="width:18em;display:inline-block"></div>asyncCallback(null);
<a name="line2883"></a><div class="linenumber">2883</div><div style="width:18em;display:inline-block"></div>return;
<a name="line2884"></a><div class="linenumber">2884</div><div style="width:16em;display:inline-block"></div>}
<a name="line2885"></a><div class="linenumber">2885</div><div style="width:16em;display:inline-block"></div>pub.events.emit("emitEasyrtcCmd",&nbsp;targetConnectionObj,&nbsp;"roomData",&nbsp;outgoingMsg,&nbsp;function(msg)&nbsp;{
<a name="line2886"></a><div class="linenumber">2886</div><div style="width:16em;display:inline-block"></div>},&nbsp;function(err)&nbsp;{
<a name="line2887"></a><div class="linenumber">2887</div><div style="width:18em;display:inline-block"></div>//&nbsp;Ignore&nbsp;errors&nbsp;if&nbsp;unable&nbsp;to&nbsp;send&nbsp;to&nbsp;a&nbsp;socket.&nbsp;
<a name="line2888"></a><div class="linenumber">2888</div><div style="width:18em;display:inline-block"></div>asyncCallback(null);
<a name="line2889"></a><div class="linenumber">2889</div><div style="width:16em;display:inline-block"></div>});
<a name="line2890"></a><div class="linenumber">2890</div><div style="width:14em;display:inline-block"></div>});
<a name="line2891"></a><div class="linenumber">2891</div><div style="width:12em;display:inline-block"></div>},
<a name="line2892"></a><div class="linenumber">2892</div><div style="width:12em;display:inline-block"></div>function(err)&nbsp;{
<a name="line2893"></a><div class="linenumber">2893</div><div style="width:14em;display:inline-block"></div>next(null);
<a name="line2894"></a><div class="linenumber">2894</div><div style="width:12em;display:inline-block"></div>}
<a name="line2895"></a><div class="linenumber">2895</div><div style="width:8em;display:inline-block"></div>);
<a name="line2896"></a><div class="linenumber">2896</div><div style="width:6em;display:inline-block"></div>});
<a name="line2897"></a><div class="linenumber">2897</div><div style="width:4em;display:inline-block"></div>};
<a name="line2898"></a><div class="linenumber">2898</div><div style="width:0em;display:inline-block"></div>
<a name="line2899"></a><div class="linenumber">2899</div><div style="width:0em;display:inline-block"></div>
<a name="line2900"></a><div class="linenumber">2900</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2901"></a><div class="linenumber">2901</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;room&nbsp;level&nbsp;field&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.
<a name="line2902"></a><div class="linenumber">2902</div><div style="width:4em;display:inline-block"></div>*
<a name="line2903"></a><div class="linenumber">2903</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line2904"></a><div class="linenumber">2904</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line2905"></a><div class="linenumber">2905</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;field&nbsp;object&nbsp;(any&nbsp;type)
<a name="line2906"></a><div class="linenumber">2906</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2907"></a><div class="linenumber">2907</div><div style="width:4em;display:inline-block"></div>roomObj.getField&nbsp;=&nbsp;function(fieldName,&nbsp;callback)&nbsp;{
<a name="line2908"></a><div class="linenumber">2908</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line2909"></a><div class="linenumber">2909</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line2910"></a><div class="linenumber">2910</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2911"></a><div class="linenumber">2911</div><div style="width:8em;display:inline-block"></div>return;
<a name="line2912"></a><div class="linenumber">2912</div><div style="width:6em;display:inline-block"></div>}
<a name="line2913"></a><div class="linenumber">2913</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!e.app[appName].room[roomName].field[fieldName])&nbsp;{
<a name="line2914"></a><div class="linenumber">2914</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("Can&nbsp;not&nbsp;find&nbsp;room&nbsp;field:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'");
<a name="line2915"></a><div class="linenumber">2915</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;find&nbsp;room&nbsp;field:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'"));
<a name="line2916"></a><div class="linenumber">2916</div><div style="width:8em;display:inline-block"></div>return;
<a name="line2917"></a><div class="linenumber">2917</div><div style="width:6em;display:inline-block"></div>}
<a name="line2918"></a><div class="linenumber">2918</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;pub.util.deepCopy(e.app[appName].room[roomName].field[fieldName]));
<a name="line2919"></a><div class="linenumber">2919</div><div style="width:4em;display:inline-block"></div>};
<a name="line2920"></a><div class="linenumber">2920</div><div style="width:0em;display:inline-block"></div>
<a name="line2921"></a><div class="linenumber">2921</div><div style="width:0em;display:inline-block"></div>
<a name="line2922"></a><div class="linenumber">2922</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2923"></a><div class="linenumber">2923</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;room&nbsp;level&nbsp;field&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.&nbsp;If&nbsp;the&nbsp;field&nbsp;is&nbsp;not&nbsp;set,&nbsp;it&nbsp;will&nbsp;return&nbsp;a&nbsp;field&nbsp;value&nbsp;will&nbsp;a&nbsp;null&nbsp;field&nbsp;value.&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;synchronous&nbsp;function,&nbsp;thus&nbsp;may&nbsp;not&nbsp;be&nbsp;available&nbsp;in&nbsp;custom&nbsp;cases&nbsp;where&nbsp;state&nbsp;is&nbsp;not&nbsp;kept&nbsp;in&nbsp;memory.
<a name="line2924"></a><div class="linenumber">2924</div><div style="width:4em;display:inline-block"></div>*
<a name="line2925"></a><div class="linenumber">2925</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line2926"></a><div class="linenumber">2926</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line2927"></a><div class="linenumber">2927</div><div style="width:4em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;object
<a name="line2928"></a><div class="linenumber">2928</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2929"></a><div class="linenumber">2929</div><div style="width:4em;display:inline-block"></div>roomObj.getFieldSync&nbsp;=&nbsp;function(fieldName)&nbsp;{
<a name="line2930"></a><div class="linenumber">2930</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line2931"></a><div class="linenumber">2931</div><div style="width:8em;display:inline-block"></div>return&nbsp;{"fieldName":&nbsp;fieldName,&nbsp;"fieldOption":&nbsp;{},&nbsp;"fieldValue":&nbsp;null};
<a name="line2932"></a><div class="linenumber">2932</div><div style="width:6em;display:inline-block"></div>}
<a name="line2933"></a><div class="linenumber">2933</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!e.app[appName].room[roomName].field[fieldName])&nbsp;{
<a name="line2934"></a><div class="linenumber">2934</div><div style="width:8em;display:inline-block"></div>return&nbsp;{"fieldName":&nbsp;fieldName,&nbsp;"fieldOption":&nbsp;{},&nbsp;"fieldValue":&nbsp;null};
<a name="line2935"></a><div class="linenumber">2935</div><div style="width:6em;display:inline-block"></div>}
<a name="line2936"></a><div class="linenumber">2936</div><div style="width:6em;display:inline-block"></div>return&nbsp;pub.util.deepCopy(e.app[appName].room[roomName].field[fieldName]);
<a name="line2937"></a><div class="linenumber">2937</div><div style="width:4em;display:inline-block"></div>};
<a name="line2938"></a><div class="linenumber">2938</div><div style="width:0em;display:inline-block"></div>
<a name="line2939"></a><div class="linenumber">2939</div><div style="width:0em;display:inline-block"></div>
<a name="line2940"></a><div class="linenumber">2940</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2941"></a><div class="linenumber">2941</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;room&nbsp;level&nbsp;field&nbsp;value&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.&nbsp;If&nbsp;the&nbsp;field&nbsp;is&nbsp;not&nbsp;set,&nbsp;it&nbsp;will&nbsp;return&nbsp;a&nbsp;null&nbsp;field&nbsp;value.&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;synchronous&nbsp;function,&nbsp;thus&nbsp;may&nbsp;not&nbsp;be&nbsp;available&nbsp;in&nbsp;custom&nbsp;cases&nbsp;where&nbsp;state&nbsp;is&nbsp;not&nbsp;kept&nbsp;in&nbsp;memory.
<a name="line2942"></a><div class="linenumber">2942</div><div style="width:4em;display:inline-block"></div>*
<a name="line2943"></a><div class="linenumber">2943</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line2944"></a><div class="linenumber">2944</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line2945"></a><div class="linenumber">2945</div><div style="width:4em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;value
<a name="line2946"></a><div class="linenumber">2946</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2947"></a><div class="linenumber">2947</div><div style="width:4em;display:inline-block"></div>roomObj.getFieldValueSync&nbsp;=&nbsp;function(fieldName)&nbsp;{
<a name="line2948"></a><div class="linenumber">2948</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line2949"></a><div class="linenumber">2949</div><div style="width:8em;display:inline-block"></div>return&nbsp;null;
<a name="line2950"></a><div class="linenumber">2950</div><div style="width:6em;display:inline-block"></div>}
<a name="line2951"></a><div class="linenumber">2951</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!e.app[appName].room[roomName].field[fieldName])&nbsp;{
<a name="line2952"></a><div class="linenumber">2952</div><div style="width:8em;display:inline-block"></div>return&nbsp;null;
<a name="line2953"></a><div class="linenumber">2953</div><div style="width:6em;display:inline-block"></div>}
<a name="line2954"></a><div class="linenumber">2954</div><div style="width:6em;display:inline-block"></div>return&nbsp;pub.util.deepCopy(e.app[appName].room[roomName].field[fieldName].fieldValue);
<a name="line2955"></a><div class="linenumber">2955</div><div style="width:4em;display:inline-block"></div>};
<a name="line2956"></a><div class="linenumber">2956</div><div style="width:0em;display:inline-block"></div>
<a name="line2957"></a><div class="linenumber">2957</div><div style="width:0em;display:inline-block"></div>
<a name="line2958"></a><div class="linenumber">2958</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2959"></a><div class="linenumber">2959</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;object&nbsp;containing&nbsp;all&nbsp;field&nbsp;names&nbsp;and&nbsp;values&nbsp;within&nbsp;the&nbsp;room.&nbsp;Can&nbsp;be&nbsp;limited&nbsp;to&nbsp;fields&nbsp;with&nbsp;isShared&nbsp;option&nbsp;set&nbsp;to&nbsp;true.
<a name="line2960"></a><div class="linenumber">2960</div><div style="width:4em;display:inline-block"></div>*
<a name="line2961"></a><div class="linenumber">2961</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line2962"></a><div class="linenumber">2962</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{boolean}&nbsp;&nbsp;&nbsp;limitToIsShared&nbsp;Limits&nbsp;returned&nbsp;fields&nbsp;to&nbsp;those&nbsp;which&nbsp;have&nbsp;the&nbsp;isShared&nbsp;option&nbsp;set&nbsp;to&nbsp;true.
<a name="line2963"></a><div class="linenumber">2963</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;field&nbsp;names&nbsp;and&nbsp;values.
<a name="line2964"></a><div class="linenumber">2964</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2965"></a><div class="linenumber">2965</div><div style="width:4em;display:inline-block"></div>roomObj.getFields&nbsp;=&nbsp;function(limitToIsShared,&nbsp;callback)&nbsp;{
<a name="line2966"></a><div class="linenumber">2966</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line2967"></a><div class="linenumber">2967</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line2968"></a><div class="linenumber">2968</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line2969"></a><div class="linenumber">2969</div><div style="width:8em;display:inline-block"></div>return;
<a name="line2970"></a><div class="linenumber">2970</div><div style="width:6em;display:inline-block"></div>}
<a name="line2971"></a><div class="linenumber">2971</div><div style="width:6em;display:inline-block"></div>var&nbsp;fieldObj&nbsp;=&nbsp;{};
<a name="line2972"></a><div class="linenumber">2972</div><div style="width:6em;display:inline-block"></div>for&nbsp;(var&nbsp;fieldName&nbsp;in&nbsp;e.app[appName].room[roomName].field)&nbsp;{
<a name="line2973"></a><div class="linenumber">2973</div><div style="width:8em;display:inline-block"></div>if&nbsp;(!limitToIsShared&nbsp;||&nbsp;e.app[appName].room[roomName].field[fieldName].fieldOption.isShared)&nbsp;{
<a name="line2974"></a><div class="linenumber">2974</div><div style="width:10em;display:inline-block"></div>fieldObj[fieldName]&nbsp;=&nbsp;{
<a name="line2975"></a><div class="linenumber">2975</div><div style="width:12em;display:inline-block"></div>fieldName:&nbsp;fieldName,
<a name="line2976"></a><div class="linenumber">2976</div><div style="width:12em;display:inline-block"></div>fieldValue:&nbsp;pub.util.deepCopy(e.app[appName].room[roomName].field[fieldName].fieldValue)
<a name="line2977"></a><div class="linenumber">2977</div><div style="width:10em;display:inline-block"></div>};
<a name="line2978"></a><div class="linenumber">2978</div><div style="width:8em;display:inline-block"></div>}
<a name="line2979"></a><div class="linenumber">2979</div><div style="width:6em;display:inline-block"></div>}
<a name="line2980"></a><div class="linenumber">2980</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;fieldObj);
<a name="line2981"></a><div class="linenumber">2981</div><div style="width:4em;display:inline-block"></div>};
<a name="line2982"></a><div class="linenumber">2982</div><div style="width:0em;display:inline-block"></div>
<a name="line2983"></a><div class="linenumber">2983</div><div style="width:0em;display:inline-block"></div>
<a name="line2984"></a><div class="linenumber">2984</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2985"></a><div class="linenumber">2985</div><div style="width:4em;display:inline-block"></div>*&nbsp;Gets&nbsp;individual&nbsp;option&nbsp;value.&nbsp;Will&nbsp;first&nbsp;check&nbsp;if&nbsp;option&nbsp;is&nbsp;defined&nbsp;for&nbsp;the&nbsp;room,&nbsp;else&nbsp;it&nbsp;will&nbsp;revert&nbsp;to&nbsp;the&nbsp;application&nbsp;level&nbsp;option&nbsp;(which&nbsp;will&nbsp;in&nbsp;turn&nbsp;fall&nbsp;back&nbsp;to&nbsp;the&nbsp;global&nbsp;level).
<a name="line2986"></a><div class="linenumber">2986</div><div style="width:4em;display:inline-block"></div>*
<a name="line2987"></a><div class="linenumber">2987</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line2988"></a><div class="linenumber">2988</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;&nbsp;&nbsp;&nbsp;optionName&nbsp;&nbsp;Option&nbsp;name
<a name="line2989"></a><div class="linenumber">2989</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{*}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Option&nbsp;value&nbsp;(can&nbsp;be&nbsp;any&nbsp;type)
<a name="line2990"></a><div class="linenumber">2990</div><div style="width:4em;display:inline-block"></div>*/
<a name="line2991"></a><div class="linenumber">2991</div><div style="width:4em;display:inline-block"></div>roomObj.getOption&nbsp;=&nbsp;function(optionName)&nbsp;{
<a name="line2992"></a><div class="linenumber">2992</div><div style="width:6em;display:inline-block"></div>return&nbsp;((!appObj.isRoomSync(roomName)&nbsp;||&nbsp;e.app[appName].room[roomName].option[optionName]&nbsp;===&nbsp;undefined)&nbsp;?&nbsp;appObj.getOption(optionName)&nbsp;:&nbsp;(e.app[appName].room[roomName].option[optionName]));
<a name="line2993"></a><div class="linenumber">2993</div><div style="width:4em;display:inline-block"></div>};
<a name="line2994"></a><div class="linenumber">2994</div><div style="width:0em;display:inline-block"></div>
<a name="line2995"></a><div class="linenumber">2995</div><div style="width:0em;display:inline-block"></div>
<a name="line2996"></a><div class="linenumber">2996</div><div style="width:4em;display:inline-block"></div>/**
<a name="line2997"></a><div class="linenumber">2997</div><div style="width:4em;display:inline-block"></div>*&nbsp;Sets&nbsp;individual&nbsp;option&nbsp;which&nbsp;applies&nbsp;only&nbsp;to&nbsp;this&nbsp;room.&nbsp;Set&nbsp;value&nbsp;to&nbsp;NULL&nbsp;to&nbsp;delete&nbsp;the&nbsp;option&nbsp;(thus&nbsp;reverting&nbsp;to&nbsp;global&nbsp;option)
<a name="line2998"></a><div class="linenumber">2998</div><div style="width:4em;display:inline-block"></div>*
<a name="line2999"></a><div class="linenumber">2999</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line3000"></a><div class="linenumber">3000</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;optionName&nbsp;&nbsp;Option&nbsp;name
<a name="line3001"></a><div class="linenumber">3001</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;optionValue&nbsp;Option&nbsp;value
<a name="line3002"></a><div class="linenumber">3002</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Boolean}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true&nbsp;on&nbsp;success,&nbsp;false&nbsp;on&nbsp;failure
<a name="line3003"></a><div class="linenumber">3003</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3004"></a><div class="linenumber">3004</div><div style="width:4em;display:inline-block"></div>roomObj.setOption&nbsp;=&nbsp;function(optionName,&nbsp;optionValue)&nbsp;{
<a name="line3005"></a><div class="linenumber">3005</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line3006"></a><div class="linenumber">3006</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line3007"></a><div class="linenumber">3007</div><div style="width:8em;display:inline-block"></div>return&nbsp;false;
<a name="line3008"></a><div class="linenumber">3008</div><div style="width:6em;display:inline-block"></div>}
<a name="line3009"></a><div class="linenumber">3009</div><div style="width:6em;display:inline-block"></div>//&nbsp;Can&nbsp;only&nbsp;set&nbsp;options&nbsp;which&nbsp;currently&nbsp;exist
<a name="line3010"></a><div class="linenumber">3010</div><div style="width:6em;display:inline-block"></div>if&nbsp;(typeof&nbsp;e.option[optionName]&nbsp;==&nbsp;"undefined")&nbsp;{
<a name="line3011"></a><div class="linenumber">3011</div><div style="width:8em;display:inline-block"></div>pub.util.logError("Error&nbsp;setting&nbsp;option.&nbsp;Unrecognised&nbsp;option&nbsp;name&nbsp;'"&nbsp;+&nbsp;optionName&nbsp;+&nbsp;"'.");
<a name="line3012"></a><div class="linenumber">3012</div><div style="width:8em;display:inline-block"></div>return&nbsp;false;
<a name="line3013"></a><div class="linenumber">3013</div><div style="width:6em;display:inline-block"></div>}
<a name="line3014"></a><div class="linenumber">3014</div><div style="width:0em;display:inline-block"></div>
<a name="line3015"></a><div class="linenumber">3015</div><div style="width:6em;display:inline-block"></div>//&nbsp;If&nbsp;value&nbsp;is&nbsp;null,&nbsp;delete&nbsp;option&nbsp;from&nbsp;application&nbsp;(reverts&nbsp;to&nbsp;global&nbsp;option)
<a name="line3016"></a><div class="linenumber">3016</div><div style="width:6em;display:inline-block"></div>if&nbsp;(optionValue&nbsp;==&nbsp;null)&nbsp;{
<a name="line3017"></a><div class="linenumber">3017</div><div style="width:8em;display:inline-block"></div>if&nbsp;(!(e.app[appName].option[optionName]&nbsp;===&nbsp;undefined))&nbsp;{
<a name="line3018"></a><div class="linenumber">3018</div><div style="width:10em;display:inline-block"></div>delete&nbsp;e.app[appName].room[roomName].option[optionName];
<a name="line3019"></a><div class="linenumber">3019</div><div style="width:8em;display:inline-block"></div>}
<a name="line3020"></a><div class="linenumber">3020</div><div style="width:6em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line3021"></a><div class="linenumber">3021</div><div style="width:8em;display:inline-block"></div>//&nbsp;Set&nbsp;the&nbsp;option&nbsp;value&nbsp;to&nbsp;be&nbsp;a&nbsp;full&nbsp;deep&nbsp;copy,&nbsp;thus&nbsp;preserving&nbsp;private&nbsp;nature&nbsp;of&nbsp;the&nbsp;private&nbsp;EasyRTC&nbsp;object.
<a name="line3022"></a><div class="linenumber">3022</div><div style="width:8em;display:inline-block"></div>e.app[appName].room[roomName].option[optionName]&nbsp;=&nbsp;pub.util.deepCopy(optionValue);
<a name="line3023"></a><div class="linenumber">3023</div><div style="width:6em;display:inline-block"></div>}
<a name="line3024"></a><div class="linenumber">3024</div><div style="width:6em;display:inline-block"></div>return&nbsp;true;
<a name="line3025"></a><div class="linenumber">3025</div><div style="width:4em;display:inline-block"></div>};
<a name="line3026"></a><div class="linenumber">3026</div><div style="width:0em;display:inline-block"></div>
<a name="line3027"></a><div class="linenumber">3027</div><div style="width:0em;display:inline-block"></div>
<a name="line3028"></a><div class="linenumber">3028</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3029"></a><div class="linenumber">3029</div><div style="width:4em;display:inline-block"></div>*&nbsp;Incomplete&nbsp;function&nbsp;for&nbsp;setting&nbsp;an&nbsp;easyrtcid&nbsp;as&nbsp;being&nbsp;a&nbsp;client&nbsp;in&nbsp;a&nbsp;room.
<a name="line3030"></a><div class="linenumber">3030</div><div style="width:4em;display:inline-block"></div>*
<a name="line3031"></a><div class="linenumber">3031</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line3032"></a><div class="linenumber">3032</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;a&nbsp;socket&nbsp;connection.
<a name="line3033"></a><div class="linenumber">3033</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line3034"></a><div class="linenumber">3034</div><div style="width:4em;display:inline-block"></div>*&nbsp;@ignore
<a name="line3035"></a><div class="linenumber">3035</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3036"></a><div class="linenumber">3036</div><div style="width:4em;display:inline-block"></div>roomObj.setConnection&nbsp;=&nbsp;function(easyrtcid,&nbsp;next)&nbsp;{
<a name="line3037"></a><div class="linenumber">3037</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line3038"></a><div class="linenumber">3038</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line3039"></a><div class="linenumber">3039</div><div style="width:8em;display:inline-block"></div>next(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line3040"></a><div class="linenumber">3040</div><div style="width:8em;display:inline-block"></div>return;
<a name="line3041"></a><div class="linenumber">3041</div><div style="width:6em;display:inline-block"></div>}
<a name="line3042"></a><div class="linenumber">3042</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Using&nbsp;deprecated&nbsp;roomObj.setConnection()&nbsp;function");
<a name="line3043"></a><div class="linenumber">3043</div><div style="width:6em;display:inline-block"></div>e.app[appName].room[roomName].clientList[easyrtcid]&nbsp;=&nbsp;{enteredOn:&nbsp;Date.now()};
<a name="line3044"></a><div class="linenumber">3044</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line3045"></a><div class="linenumber">3045</div><div style="width:4em;display:inline-block"></div>};
<a name="line3046"></a><div class="linenumber">3046</div><div style="width:0em;display:inline-block"></div>
<a name="line3047"></a><div class="linenumber">3047</div><div style="width:0em;display:inline-block"></div>
<a name="line3048"></a><div class="linenumber">3048</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3049"></a><div class="linenumber">3049</div><div style="width:4em;display:inline-block"></div>*&nbsp;Sets&nbsp;room&nbsp;field&nbsp;value&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.
<a name="line3050"></a><div class="linenumber">3050</div><div style="width:4em;display:inline-block"></div>*
<a name="line3051"></a><div class="linenumber">3051</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line3052"></a><div class="linenumber">3052</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Must&nbsp;be&nbsp;formatted&nbsp;according&nbsp;to&nbsp;"fieldNameRegExp"&nbsp;option.
<a name="line3053"></a><div class="linenumber">3053</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;fieldValue
<a name="line3054"></a><div class="linenumber">3054</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?Object}&nbsp;&nbsp;&nbsp;fieldOption&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;options&nbsp;(such&nbsp;as&nbsp;isShared&nbsp;which&nbsp;defaults&nbsp;to&nbsp;false)
<a name="line3055"></a><div class="linenumber">3055</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;[next]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).&nbsp;Possible&nbsp;err&nbsp;will&nbsp;be&nbsp;instanceof&nbsp;(ApplicationWarning).
<a name="line3056"></a><div class="linenumber">3056</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3057"></a><div class="linenumber">3057</div><div style="width:4em;display:inline-block"></div>roomObj.setField&nbsp;=&nbsp;function(fieldName,&nbsp;fieldValue,&nbsp;fieldOption,&nbsp;next)&nbsp;{
<a name="line3058"></a><div class="linenumber">3058</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line3059"></a><div class="linenumber">3059</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line3060"></a><div class="linenumber">3060</div><div style="width:8em;display:inline-block"></div>next(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line3061"></a><div class="linenumber">3061</div><div style="width:8em;display:inline-block"></div>return;
<a name="line3062"></a><div class="linenumber">3062</div><div style="width:6em;display:inline-block"></div>}
<a name="line3063"></a><div class="linenumber">3063</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]&nbsp;Room&nbsp;["&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"]&nbsp;-&nbsp;Setting&nbsp;field&nbsp;["&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"]",&nbsp;fieldValue);
<a name="line3064"></a><div class="linenumber">3064</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!_.isFunction(next))&nbsp;{
<a name="line3065"></a><div class="linenumber">3065</div><div style="width:8em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line3066"></a><div class="linenumber">3066</div><div style="width:6em;display:inline-block"></div>}
<a name="line3067"></a><div class="linenumber">3067</div><div style="width:0em;display:inline-block"></div>
<a name="line3068"></a><div class="linenumber">3068</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!pub.getOption("fieldNameRegExp").test(fieldName))&nbsp;{
<a name="line3069"></a><div class="linenumber">3069</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;room&nbsp;field&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'");
<a name="line3070"></a><div class="linenumber">3070</div><div style="width:8em;display:inline-block"></div>next(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;create&nbsp;room&nbsp;field&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'"));
<a name="line3071"></a><div class="linenumber">3071</div><div style="width:8em;display:inline-block"></div>return;
<a name="line3072"></a><div class="linenumber">3072</div><div style="width:6em;display:inline-block"></div>}
<a name="line3073"></a><div class="linenumber">3073</div><div style="width:0em;display:inline-block"></div>
<a name="line3074"></a><div class="linenumber">3074</div><div style="width:6em;display:inline-block"></div>e.app[appName].room[roomName].field[fieldName]&nbsp;=&nbsp;{
<a name="line3075"></a><div class="linenumber">3075</div><div style="width:8em;display:inline-block"></div>fieldName:&nbsp;fieldName,
<a name="line3076"></a><div class="linenumber">3076</div><div style="width:8em;display:inline-block"></div>fieldValue:&nbsp;fieldValue,
<a name="line3077"></a><div class="linenumber">3077</div><div style="width:8em;display:inline-block"></div>fieldOption:&nbsp;{isShared:&nbsp;((_.isObject(fieldOption)&nbsp;&amp;&amp;&nbsp;fieldOption.isShared)&nbsp;?&nbsp;true&nbsp;:&nbsp;false)}
<a name="line3078"></a><div class="linenumber">3078</div><div style="width:6em;display:inline-block"></div>};
<a name="line3079"></a><div class="linenumber">3079</div><div style="width:0em;display:inline-block"></div>
<a name="line3080"></a><div class="linenumber">3080</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line3081"></a><div class="linenumber">3081</div><div style="width:4em;display:inline-block"></div>};
<a name="line3082"></a><div class="linenumber">3082</div><div style="width:0em;display:inline-block"></div>
<a name="line3083"></a><div class="linenumber">3083</div><div style="width:0em;display:inline-block"></div>
<a name="line3084"></a><div class="linenumber">3084</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3085"></a><div class="linenumber">3085</div><div style="width:4em;display:inline-block"></div>*&nbsp;Sends&nbsp;the&nbsp;count&nbsp;of&nbsp;the&nbsp;number&nbsp;of&nbsp;connections&nbsp;in&nbsp;a&nbsp;room&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.
<a name="line3086"></a><div class="linenumber">3086</div><div style="width:4em;display:inline-block"></div>*
<a name="line3087"></a><div class="linenumber">3087</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line3088"></a><div class="linenumber">3088</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Number)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;containing&nbsp;all&nbsp;easyrtcids.
<a name="line3089"></a><div class="linenumber">3089</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3090"></a><div class="linenumber">3090</div><div style="width:4em;display:inline-block"></div>roomObj.getConnectionCount&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line3091"></a><div class="linenumber">3091</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line3092"></a><div class="linenumber">3092</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line3093"></a><div class="linenumber">3093</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line3094"></a><div class="linenumber">3094</div><div style="width:8em;display:inline-block"></div>return;
<a name="line3095"></a><div class="linenumber">3095</div><div style="width:6em;display:inline-block"></div>}
<a name="line3096"></a><div class="linenumber">3096</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;roomObj.getConnectionCountSync());
<a name="line3097"></a><div class="linenumber">3097</div><div style="width:4em;display:inline-block"></div>};
<a name="line3098"></a><div class="linenumber">3098</div><div style="width:0em;display:inline-block"></div>
<a name="line3099"></a><div class="linenumber">3099</div><div style="width:0em;display:inline-block"></div>
<a name="line3100"></a><div class="linenumber">3100</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3101"></a><div class="linenumber">3101</div><div style="width:4em;display:inline-block"></div>*&nbsp;Sends&nbsp;the&nbsp;count&nbsp;of&nbsp;the&nbsp;number&nbsp;of&nbsp;connections&nbsp;in&nbsp;a&nbsp;room&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.&nbsp;Returns&nbsp;0&nbsp;if&nbsp;room&nbsp;doesn't&nbsp;exist.
<a name="line3102"></a><div class="linenumber">3102</div><div style="width:4em;display:inline-block"></div>*
<a name="line3103"></a><div class="linenumber">3103</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line3104"></a><div class="linenumber">3104</div><div style="width:4em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Number}&nbsp;The&nbsp;current&nbsp;number&nbsp;of&nbsp;connections&nbsp;in&nbsp;a&nbsp;room.
<a name="line3105"></a><div class="linenumber">3105</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3106"></a><div class="linenumber">3106</div><div style="width:4em;display:inline-block"></div>roomObj.getConnectionCountSync&nbsp;=&nbsp;function()&nbsp;{
<a name="line3107"></a><div class="linenumber">3107</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line3108"></a><div class="linenumber">3108</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line3109"></a><div class="linenumber">3109</div><div style="width:8em;display:inline-block"></div>return&nbsp;0;
<a name="line3110"></a><div class="linenumber">3110</div><div style="width:6em;display:inline-block"></div>}
<a name="line3111"></a><div class="linenumber">3111</div><div style="width:6em;display:inline-block"></div>return&nbsp;_.size(e.app[appName].room[roomName].clientList);
<a name="line3112"></a><div class="linenumber">3112</div><div style="width:4em;display:inline-block"></div>};
<a name="line3113"></a><div class="linenumber">3113</div><div style="width:0em;display:inline-block"></div>
<a name="line3114"></a><div class="linenumber">3114</div><div style="width:0em;display:inline-block"></div>
<a name="line3115"></a><div class="linenumber">3115</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3116"></a><div class="linenumber">3116</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;array&nbsp;containing&nbsp;the&nbsp;easyrtcids&nbsp;of&nbsp;all&nbsp;connected&nbsp;clients&nbsp;within&nbsp;the&nbsp;room.
<a name="line3117"></a><div class="linenumber">3117</div><div style="width:4em;display:inline-block"></div>*
<a name="line3118"></a><div class="linenumber">3118</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line3119"></a><div class="linenumber">3119</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;{function(?Error,&nbsp;Array.&lt;string&gt;=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;containing&nbsp;all&nbsp;easyrtcids.
<a name="line3120"></a><div class="linenumber">3120</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3121"></a><div class="linenumber">3121</div><div style="width:4em;display:inline-block"></div>roomObj.getConnections&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line3122"></a><div class="linenumber">3122</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line3123"></a><div class="linenumber">3123</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line3124"></a><div class="linenumber">3124</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line3125"></a><div class="linenumber">3125</div><div style="width:8em;display:inline-block"></div>return;
<a name="line3126"></a><div class="linenumber">3126</div><div style="width:6em;display:inline-block"></div>}
<a name="line3127"></a><div class="linenumber">3127</div><div style="width:6em;display:inline-block"></div>var&nbsp;connectedEasyrtcidArray&nbsp;=&nbsp;[];
<a name="line3128"></a><div class="linenumber">3128</div><div style="width:6em;display:inline-block"></div>for&nbsp;(var&nbsp;key&nbsp;in&nbsp;e.app[appName].room[roomName].clientList)&nbsp;{
<a name="line3129"></a><div class="linenumber">3129</div><div style="width:8em;display:inline-block"></div>connectedEasyrtcidArray.push(key);
<a name="line3130"></a><div class="linenumber">3130</div><div style="width:6em;display:inline-block"></div>}
<a name="line3131"></a><div class="linenumber">3131</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;connectedEasyrtcidArray);
<a name="line3132"></a><div class="linenumber">3132</div><div style="width:4em;display:inline-block"></div>};
<a name="line3133"></a><div class="linenumber">3133</div><div style="width:0em;display:inline-block"></div>
<a name="line3134"></a><div class="linenumber">3134</div><div style="width:0em;display:inline-block"></div>
<a name="line3135"></a><div class="linenumber">3135</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3136"></a><div class="linenumber">3136</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;connectionObj&nbsp;for&nbsp;a&nbsp;given&nbsp;easyrtcid,&nbsp;but&nbsp;only&nbsp;if&nbsp;it&nbsp;is&nbsp;currently&nbsp;a&nbsp;client&nbsp;in&nbsp;the&nbsp;room
<a name="line3137"></a><div class="linenumber">3137</div><div style="width:4em;display:inline-block"></div>*
<a name="line3138"></a><div class="linenumber">3138</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line3139"></a><div class="linenumber">3139</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;a&nbsp;socket&nbsp;connection.
<a name="line3140"></a><div class="linenumber">3140</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;connectionObj.
<a name="line3141"></a><div class="linenumber">3141</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3142"></a><div class="linenumber">3142</div><div style="width:4em;display:inline-block"></div>roomObj.getConnectionWithEasyrtcid&nbsp;=&nbsp;function(easyrtcid,&nbsp;callback)&nbsp;{
<a name="line3143"></a><div class="linenumber">3143</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line3144"></a><div class="linenumber">3144</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line3145"></a><div class="linenumber">3145</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line3146"></a><div class="linenumber">3146</div><div style="width:8em;display:inline-block"></div>return;
<a name="line3147"></a><div class="linenumber">3147</div><div style="width:6em;display:inline-block"></div>}
<a name="line3148"></a><div class="linenumber">3148</div><div style="width:6em;display:inline-block"></div>if&nbsp;(e.app[appName].room[roomName].clientList[easyrtcid]){
<a name="line3149"></a><div class="linenumber">3149</div><div style="width:8em;display:inline-block"></div>appObj.connection(easyrtcid,&nbsp;function(err,&nbsp;connectionObj)&nbsp;{
<a name="line3150"></a><div class="linenumber">3150</div><div style="width:10em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line3151"></a><div class="linenumber">3151</div><div style="width:12em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Can&nbsp;not&nbsp;find&nbsp;connection&nbsp;["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;in&nbsp;room."));
<a name="line3152"></a><div class="linenumber">3152</div><div style="width:12em;display:inline-block"></div>return;
<a name="line3153"></a><div class="linenumber">3153</div><div style="width:10em;display:inline-block"></div>}
<a name="line3154"></a><div class="linenumber">3154</div><div style="width:10em;display:inline-block"></div>//&nbsp;If&nbsp;there&nbsp;is&nbsp;no&nbsp;error,&nbsp;than&nbsp;run&nbsp;callback&nbsp;with&nbsp;the&nbsp;connection&nbsp;object.
<a name="line3155"></a><div class="linenumber">3155</div><div style="width:10em;display:inline-block"></div>callback(null,&nbsp;connectionObj);
<a name="line3156"></a><div class="linenumber">3156</div><div style="width:8em;display:inline-block"></div>});
<a name="line3157"></a><div class="linenumber">3157</div><div style="width:6em;display:inline-block"></div>}
<a name="line3158"></a><div class="linenumber">3158</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line3159"></a><div class="linenumber">3159</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionWarning("Can&nbsp;not&nbsp;find&nbsp;connection&nbsp;["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;in&nbsp;room."));
<a name="line3160"></a><div class="linenumber">3160</div><div style="width:6em;display:inline-block"></div>}
<a name="line3161"></a><div class="linenumber">3161</div><div style="width:4em;display:inline-block"></div>};
<a name="line3162"></a><div class="linenumber">3162</div><div style="width:0em;display:inline-block"></div>
<a name="line3163"></a><div class="linenumber">3163</div><div style="width:0em;display:inline-block"></div>
<a name="line3164"></a><div class="linenumber">3164</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3165"></a><div class="linenumber">3165</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;array&nbsp;containing&nbsp;the&nbsp;connectionObjs&nbsp;of&nbsp;all&nbsp;connected&nbsp;clients&nbsp;within&nbsp;the&nbsp;room.
<a name="line3166"></a><div class="linenumber">3166</div><div style="width:4em;display:inline-block"></div>*
<a name="line3167"></a><div class="linenumber">3167</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.roomObj
<a name="line3168"></a><div class="linenumber">3168</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;{function(?Error,&nbsp;Array.&lt;Object&gt;=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;array&nbsp;containing&nbsp;connectionObjs.
<a name="line3169"></a><div class="linenumber">3169</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3170"></a><div class="linenumber">3170</div><div style="width:4em;display:inline-block"></div>roomObj.getConnectionObjects&nbsp;=&nbsp;function(callback)&nbsp;{
<a name="line3171"></a><div class="linenumber">3171</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!appObj.isRoomSync(roomName))&nbsp;{
<a name="line3172"></a><div class="linenumber">3172</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'");
<a name="line3173"></a><div class="linenumber">3173</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;room&nbsp;name:&nbsp;'"&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"'"));
<a name="line3174"></a><div class="linenumber">3174</div><div style="width:8em;display:inline-block"></div>return;
<a name="line3175"></a><div class="linenumber">3175</div><div style="width:6em;display:inline-block"></div>}
<a name="line3176"></a><div class="linenumber">3176</div><div style="width:6em;display:inline-block"></div>var&nbsp;connectedObjArray&nbsp;=&nbsp;[];
<a name="line3177"></a><div class="linenumber">3177</div><div style="width:6em;display:inline-block"></div>async.each(Object.keys(e.app[appName].room[roomName].clientList),
<a name="line3178"></a><div class="linenumber">3178</div><div style="width:10em;display:inline-block"></div>function(currentEasyrtcid,&nbsp;asyncCallback)&nbsp;{
<a name="line3179"></a><div class="linenumber">3179</div><div style="width:12em;display:inline-block"></div>appObj.connection(currentEasyrtcid,&nbsp;function(err,&nbsp;connectionObj)&nbsp;{
<a name="line3180"></a><div class="linenumber">3180</div><div style="width:14em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line3181"></a><div class="linenumber">3181</div><div style="width:16em;display:inline-block"></div>//&nbsp;We&nbsp;will&nbsp;silently&nbsp;ignore&nbsp;errors
<a name="line3182"></a><div class="linenumber">3182</div><div style="width:16em;display:inline-block"></div>asyncCallback(null);
<a name="line3183"></a><div class="linenumber">3183</div><div style="width:16em;display:inline-block"></div>return;
<a name="line3184"></a><div class="linenumber">3184</div><div style="width:14em;display:inline-block"></div>}
<a name="line3185"></a><div class="linenumber">3185</div><div style="width:14em;display:inline-block"></div>//&nbsp;If&nbsp;there&nbsp;is&nbsp;no&nbsp;error,&nbsp;than&nbsp;push&nbsp;the&nbsp;connection&nbsp;object.
<a name="line3186"></a><div class="linenumber">3186</div><div style="width:14em;display:inline-block"></div>connectedObjArray.push(connectionObj);
<a name="line3187"></a><div class="linenumber">3187</div><div style="width:14em;display:inline-block"></div>asyncCallback(null);
<a name="line3188"></a><div class="linenumber">3188</div><div style="width:12em;display:inline-block"></div>});
<a name="line3189"></a><div class="linenumber">3189</div><div style="width:10em;display:inline-block"></div>},
<a name="line3190"></a><div class="linenumber">3190</div><div style="width:10em;display:inline-block"></div>function(err)&nbsp;{
<a name="line3191"></a><div class="linenumber">3191</div><div style="width:12em;display:inline-block"></div>callback(null,&nbsp;connectedObjArray);
<a name="line3192"></a><div class="linenumber">3192</div><div style="width:10em;display:inline-block"></div>}
<a name="line3193"></a><div class="linenumber">3193</div><div style="width:6em;display:inline-block"></div>);
<a name="line3194"></a><div class="linenumber">3194</div><div style="width:4em;display:inline-block"></div>};
<a name="line3195"></a><div class="linenumber">3195</div><div style="width:0em;display:inline-block"></div>
<a name="line3196"></a><div class="linenumber">3196</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;roomObj);
<a name="line3197"></a><div class="linenumber">3197</div><div style="width:2em;display:inline-block"></div>};
<a name="line3198"></a><div class="linenumber">3198</div><div style="width:0em;display:inline-block"></div>
<a name="line3199"></a><div class="linenumber">3199</div><div style="width:0em;display:inline-block"></div>
<a name="line3200"></a><div class="linenumber">3200</div><div style="width:2em;display:inline-block"></div>/**
<a name="line3201"></a><div class="linenumber">3201</div><div style="width:2em;display:inline-block"></div>*&nbsp;NOT&nbsp;YET&nbsp;IMPLEMENTED&nbsp;-&nbsp;Gets&nbsp;session&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;easyrtcsid.&nbsp;Returns&nbsp;null&nbsp;if&nbsp;session&nbsp;not&nbsp;found.
<a name="line3202"></a><div class="linenumber">3202</div><div style="width:2em;display:inline-block"></div>*&nbsp;The&nbsp;returned&nbsp;session&nbsp;object&nbsp;includes&nbsp;functions&nbsp;for&nbsp;managing&nbsp;session&nbsp;fields.
<a name="line3203"></a><div class="linenumber">3203</div><div style="width:2em;display:inline-block"></div>*
<a name="line3204"></a><div class="linenumber">3204</div><div style="width:2em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line3205"></a><div class="linenumber">3205</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcsid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;session&nbsp;identifier
<a name="line3206"></a><div class="linenumber">3206</div><div style="width:2em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;EasyRTC&nbsp;session&nbsp;object.
<a name="line3207"></a><div class="linenumber">3207</div><div style="width:2em;display:inline-block"></div>*/
<a name="line3208"></a><div class="linenumber">3208</div><div style="width:2em;display:inline-block"></div>appObj.session&nbsp;=&nbsp;function(easyrtcsid,&nbsp;callback)&nbsp;{
<a name="line3209"></a><div class="linenumber">3209</div><div style="width:0em;display:inline-block"></div>
<a name="line3210"></a><div class="linenumber">3210</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!e.app[appName].session[easyrtcsid])&nbsp;{
<a name="line3211"></a><div class="linenumber">3211</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;easyrtcsid:&nbsp;'"&nbsp;+&nbsp;easyrtcsid&nbsp;+&nbsp;"'");
<a name="line3212"></a><div class="linenumber">3212</div><div style="width:6em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Attempt&nbsp;to&nbsp;request&nbsp;non-existent&nbsp;easyrtcsid:&nbsp;'"&nbsp;+&nbsp;easyrtcsid&nbsp;+&nbsp;"'"));
<a name="line3213"></a><div class="linenumber">3213</div><div style="width:6em;display:inline-block"></div>return;
<a name="line3214"></a><div class="linenumber">3214</div><div style="width:4em;display:inline-block"></div>}
<a name="line3215"></a><div class="linenumber">3215</div><div style="width:0em;display:inline-block"></div>
<a name="line3216"></a><div class="linenumber">3216</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3217"></a><div class="linenumber">3217</div><div style="width:4em;display:inline-block"></div>*&nbsp;The&nbsp;primary&nbsp;method&nbsp;for&nbsp;interfacing&nbsp;with&nbsp;an&nbsp;EasyRTC&nbsp;session.
<a name="line3218"></a><div class="linenumber">3218</div><div style="width:4em;display:inline-block"></div>*
<a name="line3219"></a><div class="linenumber">3219</div><div style="width:4em;display:inline-block"></div>*&nbsp;@class&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sessionObj
<a name="line3220"></a><div class="linenumber">3220</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj
<a name="line3221"></a><div class="linenumber">3221</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3222"></a><div class="linenumber">3222</div><div style="width:4em;display:inline-block"></div>var&nbsp;sessionObj&nbsp;=&nbsp;{};
<a name="line3223"></a><div class="linenumber">3223</div><div style="width:0em;display:inline-block"></div>
<a name="line3224"></a><div class="linenumber">3224</div><div style="width:0em;display:inline-block"></div>
<a name="line3225"></a><div class="linenumber">3225</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3226"></a><div class="linenumber">3226</div><div style="width:4em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;event&nbsp;functions
<a name="line3227"></a><div class="linenumber">3227</div><div style="width:4em;display:inline-block"></div>*
<a name="line3228"></a><div class="linenumber">3228</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.sessionObj
<a name="line3229"></a><div class="linenumber">3229</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3230"></a><div class="linenumber">3230</div><div style="width:4em;display:inline-block"></div>sessionObj.events&nbsp;=&nbsp;pub.events;
<a name="line3231"></a><div class="linenumber">3231</div><div style="width:0em;display:inline-block"></div>
<a name="line3232"></a><div class="linenumber">3232</div><div style="width:0em;display:inline-block"></div>
<a name="line3233"></a><div class="linenumber">3233</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3234"></a><div class="linenumber">3234</div><div style="width:4em;display:inline-block"></div>*&nbsp;Expose&nbsp;all&nbsp;utility&nbsp;functions
<a name="line3235"></a><div class="linenumber">3235</div><div style="width:4em;display:inline-block"></div>*
<a name="line3236"></a><div class="linenumber">3236</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.sessionObj
<a name="line3237"></a><div class="linenumber">3237</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3238"></a><div class="linenumber">3238</div><div style="width:4em;display:inline-block"></div>sessionObj.util&nbsp;=&nbsp;pub.util;
<a name="line3239"></a><div class="linenumber">3239</div><div style="width:0em;display:inline-block"></div>
<a name="line3240"></a><div class="linenumber">3240</div><div style="width:0em;display:inline-block"></div>
<a name="line3241"></a><div class="linenumber">3241</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3242"></a><div class="linenumber">3242</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;application&nbsp;object&nbsp;to&nbsp;which&nbsp;the&nbsp;session&nbsp;belongs.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line3243"></a><div class="linenumber">3243</div><div style="width:4em;display:inline-block"></div>*
<a name="line3244"></a><div class="linenumber">3244</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.sessionObj
<a name="line3245"></a><div class="linenumber">3245</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;application&nbsp;object
<a name="line3246"></a><div class="linenumber">3246</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3247"></a><div class="linenumber">3247</div><div style="width:4em;display:inline-block"></div>sessionObj.getApp&nbsp;=&nbsp;function()&nbsp;{
<a name="line3248"></a><div class="linenumber">3248</div><div style="width:6em;display:inline-block"></div>return&nbsp;appObj;
<a name="line3249"></a><div class="linenumber">3249</div><div style="width:4em;display:inline-block"></div>};
<a name="line3250"></a><div class="linenumber">3250</div><div style="width:0em;display:inline-block"></div>
<a name="line3251"></a><div class="linenumber">3251</div><div style="width:0em;display:inline-block"></div>
<a name="line3252"></a><div class="linenumber">3252</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3253"></a><div class="linenumber">3253</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;application&nbsp;name&nbsp;for&nbsp;the&nbsp;application&nbsp;to&nbsp;which&nbsp;the&nbsp;session&nbsp;belongs.&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line3254"></a><div class="linenumber">3254</div><div style="width:4em;display:inline-block"></div>*
<a name="line3255"></a><div class="linenumber">3255</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.sessionObj
<a name="line3256"></a><div class="linenumber">3256</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;application&nbsp;name
<a name="line3257"></a><div class="linenumber">3257</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3258"></a><div class="linenumber">3258</div><div style="width:4em;display:inline-block"></div>sessionObj.getAppName&nbsp;=&nbsp;function()&nbsp;{
<a name="line3259"></a><div class="linenumber">3259</div><div style="width:6em;display:inline-block"></div>return&nbsp;appName;
<a name="line3260"></a><div class="linenumber">3260</div><div style="width:4em;display:inline-block"></div>};
<a name="line3261"></a><div class="linenumber">3261</div><div style="width:0em;display:inline-block"></div>
<a name="line3262"></a><div class="linenumber">3262</div><div style="width:0em;display:inline-block"></div>
<a name="line3263"></a><div class="linenumber">3263</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3264"></a><div class="linenumber">3264</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;easyrtcsid&nbsp;for&nbsp;the&nbsp;session.&nbsp;&nbsp;Note&nbsp;that&nbsp;unlike&nbsp;most&nbsp;EasyRTC&nbsp;functions,&nbsp;this&nbsp;returns&nbsp;a&nbsp;value&nbsp;and&nbsp;does&nbsp;not&nbsp;use&nbsp;a&nbsp;callback.
<a name="line3265"></a><div class="linenumber">3265</div><div style="width:4em;display:inline-block"></div>*
<a name="line3266"></a><div class="linenumber">3266</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.sessionObj
<a name="line3267"></a><div class="linenumber">3267</div><div style="width:4em;display:inline-block"></div>*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;the&nbsp;easyrtcsid,&nbsp;which&nbsp;is&nbsp;the&nbsp;EasyRTC&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;a&nbsp;session.
<a name="line3268"></a><div class="linenumber">3268</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3269"></a><div class="linenumber">3269</div><div style="width:4em;display:inline-block"></div>sessionObj.getEasyrtcsid&nbsp;=&nbsp;function()&nbsp;{
<a name="line3270"></a><div class="linenumber">3270</div><div style="width:6em;display:inline-block"></div>return&nbsp;easyrtcsid;
<a name="line3271"></a><div class="linenumber">3271</div><div style="width:4em;display:inline-block"></div>};
<a name="line3272"></a><div class="linenumber">3272</div><div style="width:0em;display:inline-block"></div>
<a name="line3273"></a><div class="linenumber">3273</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3274"></a><div class="linenumber">3274</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;the&nbsp;easyrtcsid&nbsp;for&nbsp;the&nbsp;session.&nbsp;Old&nbsp;SessionKey&nbsp;name&nbsp;kept&nbsp;for&nbsp;transition&nbsp;purposes.&nbsp;Use&nbsp;getEasyrtcsid();
<a name="line3275"></a><div class="linenumber">3275</div><div style="width:4em;display:inline-block"></div>*&nbsp;
<a name="line3276"></a><div class="linenumber">3276</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.sessionObj
<a name="line3277"></a><div class="linenumber">3277</div><div style="width:4em;display:inline-block"></div>*&nbsp;@ignore
<a name="line3278"></a><div class="linenumber">3278</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3279"></a><div class="linenumber">3279</div><div style="width:4em;display:inline-block"></div>sessionObj.getSessionKey&nbsp;=&nbsp;sessionObj.getEasyrtcsid;
<a name="line3280"></a><div class="linenumber">3280</div><div style="width:0em;display:inline-block"></div>
<a name="line3281"></a><div class="linenumber">3281</div><div style="width:0em;display:inline-block"></div>
<a name="line3282"></a><div class="linenumber">3282</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3283"></a><div class="linenumber">3283</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;session&nbsp;level&nbsp;field&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.
<a name="line3284"></a><div class="linenumber">3284</div><div style="width:4em;display:inline-block"></div>*
<a name="line3285"></a><div class="linenumber">3285</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.sessionObj
<a name="line3286"></a><div class="linenumber">3286</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line3287"></a><div class="linenumber">3287</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;field&nbsp;value&nbsp;(any&nbsp;type)
<a name="line3288"></a><div class="linenumber">3288</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3289"></a><div class="linenumber">3289</div><div style="width:4em;display:inline-block"></div>sessionObj.getField&nbsp;=&nbsp;function(fieldName,&nbsp;callback)&nbsp;{
<a name="line3290"></a><div class="linenumber">3290</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!e.app[appName].session[easyrtcsid].field[fieldName])&nbsp;{
<a name="line3291"></a><div class="linenumber">3291</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("Can&nbsp;not&nbsp;find&nbsp;session&nbsp;field:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'");
<a name="line3292"></a><div class="linenumber">3292</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;find&nbsp;session&nbsp;field:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'"));
<a name="line3293"></a><div class="linenumber">3293</div><div style="width:8em;display:inline-block"></div>return;
<a name="line3294"></a><div class="linenumber">3294</div><div style="width:6em;display:inline-block"></div>}
<a name="line3295"></a><div class="linenumber">3295</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;pub.util.deepCopy(e.app[appName].session[easyrtcsid].field[fieldName]));
<a name="line3296"></a><div class="linenumber">3296</div><div style="width:4em;display:inline-block"></div>};
<a name="line3297"></a><div class="linenumber">3297</div><div style="width:0em;display:inline-block"></div>
<a name="line3298"></a><div class="linenumber">3298</div><div style="width:0em;display:inline-block"></div>
<a name="line3299"></a><div class="linenumber">3299</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3300"></a><div class="linenumber">3300</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;session&nbsp;level&nbsp;field&nbsp;object&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.&nbsp;If&nbsp;the&nbsp;field&nbsp;is&nbsp;not&nbsp;set,&nbsp;it&nbsp;will&nbsp;return&nbsp;a&nbsp;field&nbsp;object&nbsp;will&nbsp;a&nbsp;null&nbsp;field&nbsp;value.&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;synchronous&nbsp;function,&nbsp;thus&nbsp;may&nbsp;not&nbsp;be&nbsp;available&nbsp;in&nbsp;custom&nbsp;cases&nbsp;where&nbsp;state&nbsp;is&nbsp;not&nbsp;kept&nbsp;in&nbsp;memory.
<a name="line3301"></a><div class="linenumber">3301</div><div style="width:4em;display:inline-block"></div>*
<a name="line3302"></a><div class="linenumber">3302</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.sessionObj
<a name="line3303"></a><div class="linenumber">3303</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line3304"></a><div class="linenumber">3304</div><div style="width:4em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;object
<a name="line3305"></a><div class="linenumber">3305</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3306"></a><div class="linenumber">3306</div><div style="width:4em;display:inline-block"></div>sessionObj.getFieldSync&nbsp;=&nbsp;function(fieldName)&nbsp;{
<a name="line3307"></a><div class="linenumber">3307</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!e.app[appName].session[easyrtcsid].field[fieldName])&nbsp;{
<a name="line3308"></a><div class="linenumber">3308</div><div style="width:8em;display:inline-block"></div>return&nbsp;{"fieldName":&nbsp;fieldName,&nbsp;"fieldOption":&nbsp;{},&nbsp;"fieldValue":&nbsp;null};
<a name="line3309"></a><div class="linenumber">3309</div><div style="width:6em;display:inline-block"></div>}
<a name="line3310"></a><div class="linenumber">3310</div><div style="width:6em;display:inline-block"></div>return&nbsp;pub.util.deepCopy(e.app[appName].session[easyrtcsid].field[fieldName]);
<a name="line3311"></a><div class="linenumber">3311</div><div style="width:4em;display:inline-block"></div>};
<a name="line3312"></a><div class="linenumber">3312</div><div style="width:0em;display:inline-block"></div>
<a name="line3313"></a><div class="linenumber">3313</div><div style="width:0em;display:inline-block"></div>
<a name="line3314"></a><div class="linenumber">3314</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3315"></a><div class="linenumber">3315</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;session&nbsp;level&nbsp;field&nbsp;value&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.&nbsp;If&nbsp;the&nbsp;field&nbsp;is&nbsp;not&nbsp;set,&nbsp;it&nbsp;will&nbsp;return&nbsp;a&nbsp;null&nbsp;field&nbsp;value.&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;synchronous&nbsp;function,&nbsp;thus&nbsp;may&nbsp;not&nbsp;be&nbsp;available&nbsp;in&nbsp;custom&nbsp;cases&nbsp;where&nbsp;state&nbsp;is&nbsp;not&nbsp;kept&nbsp;in&nbsp;memory.
<a name="line3316"></a><div class="linenumber">3316</div><div style="width:4em;display:inline-block"></div>*
<a name="line3317"></a><div class="linenumber">3317</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.sessionObj
<a name="line3318"></a><div class="linenumber">3318</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;Field&nbsp;name
<a name="line3319"></a><div class="linenumber">3319</div><div style="width:4em;display:inline-block"></div>*&nbsp;@returns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;value
<a name="line3320"></a><div class="linenumber">3320</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3321"></a><div class="linenumber">3321</div><div style="width:4em;display:inline-block"></div>sessionObj.getFieldValueSync&nbsp;=&nbsp;function(fieldName)&nbsp;{
<a name="line3322"></a><div class="linenumber">3322</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!e.app[appName].session[easyrtcsid].field[fieldName])&nbsp;{
<a name="line3323"></a><div class="linenumber">3323</div><div style="width:8em;display:inline-block"></div>return&nbsp;null;
<a name="line3324"></a><div class="linenumber">3324</div><div style="width:6em;display:inline-block"></div>}
<a name="line3325"></a><div class="linenumber">3325</div><div style="width:6em;display:inline-block"></div>return&nbsp;pub.util.deepCopy(e.app[appName].session[easyrtcsid].field[fieldName].fieldValue);
<a name="line3326"></a><div class="linenumber">3326</div><div style="width:4em;display:inline-block"></div>};
<a name="line3327"></a><div class="linenumber">3327</div><div style="width:0em;display:inline-block"></div>
<a name="line3328"></a><div class="linenumber">3328</div><div style="width:0em;display:inline-block"></div>
<a name="line3329"></a><div class="linenumber">3329</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3330"></a><div class="linenumber">3330</div><div style="width:4em;display:inline-block"></div>*&nbsp;Returns&nbsp;an&nbsp;object&nbsp;containing&nbsp;all&nbsp;field&nbsp;names&nbsp;and&nbsp;values&nbsp;within&nbsp;the&nbsp;session&nbsp;to&nbsp;a&nbsp;provided&nbsp;callback.&nbsp;Can&nbsp;be&nbsp;limited&nbsp;to&nbsp;fields&nbsp;with&nbsp;isShared&nbsp;option&nbsp;set&nbsp;to&nbsp;true.
<a name="line3331"></a><div class="linenumber">3331</div><div style="width:4em;display:inline-block"></div>*
<a name="line3332"></a><div class="linenumber">3332</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.sessionObj
<a name="line3333"></a><div class="linenumber">3333</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{boolean}&nbsp;&nbsp;&nbsp;limitToIsShared&nbsp;Limits&nbsp;returned&nbsp;fields&nbsp;to&nbsp;those&nbsp;which&nbsp;have&nbsp;the&nbsp;isShared&nbsp;option&nbsp;set&nbsp;to&nbsp;true.
<a name="line3334"></a><div class="linenumber">3334</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{function(?Error,&nbsp;Object=)}&nbsp;callback&nbsp;Callback&nbsp;with&nbsp;error&nbsp;and&nbsp;object&nbsp;containing&nbsp;field&nbsp;names&nbsp;and&nbsp;values.
<a name="line3335"></a><div class="linenumber">3335</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3336"></a><div class="linenumber">3336</div><div style="width:4em;display:inline-block"></div>sessionObj.getFields&nbsp;=&nbsp;function(limitToIsShared,&nbsp;callback)&nbsp;{
<a name="line3337"></a><div class="linenumber">3337</div><div style="width:6em;display:inline-block"></div>var&nbsp;fieldObj&nbsp;=&nbsp;{};
<a name="line3338"></a><div class="linenumber">3338</div><div style="width:6em;display:inline-block"></div>for&nbsp;(var&nbsp;fieldName&nbsp;in&nbsp;e.app[appName].session[easyrtcsid].field)&nbsp;{
<a name="line3339"></a><div class="linenumber">3339</div><div style="width:8em;display:inline-block"></div>if&nbsp;(!limitToIsShared&nbsp;||&nbsp;e.app[appName].session[easyrtcsid].field[fieldName].fieldOption.isShared)&nbsp;{
<a name="line3340"></a><div class="linenumber">3340</div><div style="width:10em;display:inline-block"></div>fieldObj[fieldName]&nbsp;=&nbsp;{
<a name="line3341"></a><div class="linenumber">3341</div><div style="width:12em;display:inline-block"></div>fieldName:&nbsp;fieldName,
<a name="line3342"></a><div class="linenumber">3342</div><div style="width:12em;display:inline-block"></div>fieldValue:&nbsp;pub.util.deepCopy(e.app[appName].session[easyrtcsid].field[fieldName].fieldValue)
<a name="line3343"></a><div class="linenumber">3343</div><div style="width:10em;display:inline-block"></div>};
<a name="line3344"></a><div class="linenumber">3344</div><div style="width:8em;display:inline-block"></div>}
<a name="line3345"></a><div class="linenumber">3345</div><div style="width:6em;display:inline-block"></div>}
<a name="line3346"></a><div class="linenumber">3346</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;fieldObj);
<a name="line3347"></a><div class="linenumber">3347</div><div style="width:4em;display:inline-block"></div>};
<a name="line3348"></a><div class="linenumber">3348</div><div style="width:0em;display:inline-block"></div>
<a name="line3349"></a><div class="linenumber">3349</div><div style="width:0em;display:inline-block"></div>
<a name="line3350"></a><div class="linenumber">3350</div><div style="width:4em;display:inline-block"></div>/**
<a name="line3351"></a><div class="linenumber">3351</div><div style="width:4em;display:inline-block"></div>*&nbsp;Sets&nbsp;session&nbsp;field&nbsp;value&nbsp;for&nbsp;a&nbsp;given&nbsp;field&nbsp;name.
<a name="line3352"></a><div class="linenumber">3352</div><div style="width:4em;display:inline-block"></div>*
<a name="line3353"></a><div class="linenumber">3353</div><div style="width:4em;display:inline-block"></div>*&nbsp;@memberof&nbsp;&nbsp;&nbsp;&nbsp;pub.appObj.sessionObj
<a name="line3354"></a><div class="linenumber">3354</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;&nbsp;&nbsp;&nbsp;fieldName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Must&nbsp;be&nbsp;formatted&nbsp;according&nbsp;to&nbsp;"fieldNameRegExp"&nbsp;option.
<a name="line3355"></a><div class="linenumber">3355</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;fieldValue
<a name="line3356"></a><div class="linenumber">3356</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?Object}&nbsp;&nbsp;&nbsp;fieldOption&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field&nbsp;options&nbsp;(such&nbsp;as&nbsp;isShared&nbsp;which&nbsp;defaults&nbsp;to&nbsp;false)
<a name="line3357"></a><div class="linenumber">3357</div><div style="width:4em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;[next]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).&nbsp;Possible&nbsp;err&nbsp;will&nbsp;be&nbsp;instanceof&nbsp;(ApplicationWarning).
<a name="line3358"></a><div class="linenumber">3358</div><div style="width:4em;display:inline-block"></div>*/
<a name="line3359"></a><div class="linenumber">3359</div><div style="width:4em;display:inline-block"></div>sessionObj.setField&nbsp;=&nbsp;function(fieldName,&nbsp;fieldValue,&nbsp;fieldOption,&nbsp;next)&nbsp;{
<a name="line3360"></a><div class="linenumber">3360</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;appName&nbsp;+&nbsp;"]&nbsp;Session&nbsp;["&nbsp;+&nbsp;easyrtcsid&nbsp;+&nbsp;"]&nbsp;-&nbsp;Setting&nbsp;field&nbsp;["&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"]",&nbsp;fieldValue);
<a name="line3361"></a><div class="linenumber">3361</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!_.isFunction(next))&nbsp;{
<a name="line3362"></a><div class="linenumber">3362</div><div style="width:8em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line3363"></a><div class="linenumber">3363</div><div style="width:6em;display:inline-block"></div>}
<a name="line3364"></a><div class="linenumber">3364</div><div style="width:0em;display:inline-block"></div>
<a name="line3365"></a><div class="linenumber">3365</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!pub.getOption("fieldNameRegExp").test(fieldName))&nbsp;{
<a name="line3366"></a><div class="linenumber">3366</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Can&nbsp;not&nbsp;create&nbsp;session&nbsp;field&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'");
<a name="line3367"></a><div class="linenumber">3367</div><div style="width:8em;display:inline-block"></div>next(new&nbsp;pub.util.ApplicationWarning("Can&nbsp;not&nbsp;create&nbsp;session&nbsp;field&nbsp;with&nbsp;improper&nbsp;name:&nbsp;'"&nbsp;+&nbsp;fieldName&nbsp;+&nbsp;"'"));
<a name="line3368"></a><div class="linenumber">3368</div><div style="width:8em;display:inline-block"></div>return;
<a name="line3369"></a><div class="linenumber">3369</div><div style="width:6em;display:inline-block"></div>}
<a name="line3370"></a><div class="linenumber">3370</div><div style="width:0em;display:inline-block"></div>
<a name="line3371"></a><div class="linenumber">3371</div><div style="width:6em;display:inline-block"></div>e.app[appName].session[easyrtcsid].field[fieldName]&nbsp;=&nbsp;{
<a name="line3372"></a><div class="linenumber">3372</div><div style="width:8em;display:inline-block"></div>fieldName:&nbsp;fieldName,
<a name="line3373"></a><div class="linenumber">3373</div><div style="width:8em;display:inline-block"></div>fieldValue:&nbsp;fieldValue,
<a name="line3374"></a><div class="linenumber">3374</div><div style="width:8em;display:inline-block"></div>fieldOption:&nbsp;{isShared:&nbsp;((_.isObject(fieldOption)&nbsp;&amp;&amp;&nbsp;fieldOption.isShared)&nbsp;?&nbsp;true&nbsp;:&nbsp;false)}
<a name="line3375"></a><div class="linenumber">3375</div><div style="width:6em;display:inline-block"></div>};
<a name="line3376"></a><div class="linenumber">3376</div><div style="width:0em;display:inline-block"></div>
<a name="line3377"></a><div class="linenumber">3377</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line3378"></a><div class="linenumber">3378</div><div style="width:4em;display:inline-block"></div>};
<a name="line3379"></a><div class="linenumber">3379</div><div style="width:0em;display:inline-block"></div>
<a name="line3380"></a><div class="linenumber">3380</div><div style="width:4em;display:inline-block"></div>sessionObj.emitSessionDataFieldUpdate&nbsp;=&nbsp;function(next)&nbsp;{
<a name="line3381"></a><div class="linenumber">3381</div><div style="width:6em;display:inline-block"></div>sessionObj.getFields(true,&nbsp;function(err,&nbsp;fieldObj)&nbsp;{
<a name="line3382"></a><div class="linenumber">3382</div><div style="width:8em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line3383"></a><div class="linenumber">3383</div><div style="width:10em;display:inline-block"></div>next(err);
<a name="line3384"></a><div class="linenumber">3384</div><div style="width:10em;display:inline-block"></div>return;
<a name="line3385"></a><div class="linenumber">3385</div><div style="width:8em;display:inline-block"></div>}
<a name="line3386"></a><div class="linenumber">3386</div><div style="width:8em;display:inline-block"></div>var&nbsp;outgoingMsg&nbsp;=&nbsp;{"msgData":&nbsp;{"sessionData":&nbsp;{}}};
<a name="line3387"></a><div class="linenumber">3387</div><div style="width:8em;display:inline-block"></div>outgoingMsg.msgData.sessionData&nbsp;=&nbsp;{
<a name="line3388"></a><div class="linenumber">3388</div><div style="width:10em;display:inline-block"></div>"easyrtcsid":&nbsp;easyrtcsid,
<a name="line3389"></a><div class="linenumber">3389</div><div style="width:10em;display:inline-block"></div>"sessionStatus":&nbsp;"update"
<a name="line3390"></a><div class="linenumber">3390</div><div style="width:8em;display:inline-block"></div>};
<a name="line3391"></a><div class="linenumber">3391</div><div style="width:8em;display:inline-block"></div>outgoingMsg.msgData.sessionData.field&nbsp;=&nbsp;fieldObj;
<a name="line3392"></a><div class="linenumber">3392</div><div style="width:8em;display:inline-block"></div>//&nbsp;Loop&nbsp;through&nbsp;all&nbsp;active&nbsp;connection&nbsp;objects&nbsp;belonging&nbsp;to&nbsp;session
<a name="line3393"></a><div class="linenumber">3393</div><div style="width:8em;display:inline-block"></div>async.each(
<a name="line3394"></a><div class="linenumber">3394</div><div style="width:10em;display:inline-block"></div>Object.keys(e.app[appName].session[easyrtcsid].toConnection),
<a name="line3395"></a><div class="linenumber">3395</div><div style="width:10em;display:inline-block"></div>function(currentEasyrtcid,&nbsp;asyncCallback)&nbsp;{
<a name="line3396"></a><div class="linenumber">3396</div><div style="width:0em;display:inline-block"></div>
<a name="line3397"></a><div class="linenumber">3397</div><div style="width:12em;display:inline-block"></div>//&nbsp;Retrieve&nbsp;a&nbsp;connection&nbsp;object,&nbsp;then&nbsp;send&nbsp;the&nbsp;sessionData&nbsp;message.
<a name="line3398"></a><div class="linenumber">3398</div><div style="width:12em;display:inline-block"></div>appObj.connection(currentEasyrtcid,&nbsp;function(err,&nbsp;targetConnectionObj)&nbsp;{
<a name="line3399"></a><div class="linenumber">3399</div><div style="width:14em;display:inline-block"></div>if&nbsp;(err&nbsp;||&nbsp;!_.isObject(targetConnectionObj))&nbsp;{
<a name="line3400"></a><div class="linenumber">3400</div><div style="width:16em;display:inline-block"></div>pub.util.logDebug("["&nbsp;+&nbsp;currentEasyrtcid&nbsp;+&nbsp;"]&nbsp;Could&nbsp;not&nbsp;get&nbsp;connection&nbsp;object&nbsp;to&nbsp;send&nbsp;session&nbsp;data&nbsp;field&nbsp;update.&nbsp;Client&nbsp;may&nbsp;have&nbsp;disconnected.");
<a name="line3401"></a><div class="linenumber">3401</div><div style="width:16em;display:inline-block"></div>asyncCallback(null);
<a name="line3402"></a><div class="linenumber">3402</div><div style="width:16em;display:inline-block"></div>return;
<a name="line3403"></a><div class="linenumber">3403</div><div style="width:14em;display:inline-block"></div>}
<a name="line3404"></a><div class="linenumber">3404</div><div style="width:0em;display:inline-block"></div>
<a name="line3405"></a><div class="linenumber">3405</div><div style="width:14em;display:inline-block"></div>//&nbsp;Emit&nbsp;sessionData&nbsp;easyrtcCmd&nbsp;to&nbsp;each&nbsp;connection
<a name="line3406"></a><div class="linenumber">3406</div><div style="width:14em;display:inline-block"></div>pub.events.emit("emitEasyrtcCmd",&nbsp;targetConnectionObj,&nbsp;"sessionData",&nbsp;outgoingMsg,&nbsp;function(msg)&nbsp;{
<a name="line3407"></a><div class="linenumber">3407</div><div style="width:14em;display:inline-block"></div>},&nbsp;function(err)&nbsp;{
<a name="line3408"></a><div class="linenumber">3408</div><div style="width:16em;display:inline-block"></div>//&nbsp;Ignore&nbsp;errors&nbsp;if&nbsp;unable&nbsp;to&nbsp;send&nbsp;to&nbsp;a&nbsp;socket.&nbsp;
<a name="line3409"></a><div class="linenumber">3409</div><div style="width:16em;display:inline-block"></div>asyncCallback(null);
<a name="line3410"></a><div class="linenumber">3410</div><div style="width:14em;display:inline-block"></div>});
<a name="line3411"></a><div class="linenumber">3411</div><div style="width:12em;display:inline-block"></div>});
<a name="line3412"></a><div class="linenumber">3412</div><div style="width:10em;display:inline-block"></div>},
<a name="line3413"></a><div class="linenumber">3413</div><div style="width:10em;display:inline-block"></div>function(err)&nbsp;{
<a name="line3414"></a><div class="linenumber">3414</div><div style="width:12em;display:inline-block"></div>next(null);
<a name="line3415"></a><div class="linenumber">3415</div><div style="width:10em;display:inline-block"></div>}
<a name="line3416"></a><div class="linenumber">3416</div><div style="width:8em;display:inline-block"></div>);
<a name="line3417"></a><div class="linenumber">3417</div><div style="width:6em;display:inline-block"></div>});
<a name="line3418"></a><div class="linenumber">3418</div><div style="width:4em;display:inline-block"></div>};
<a name="line3419"></a><div class="linenumber">3419</div><div style="width:0em;display:inline-block"></div>
<a name="line3420"></a><div class="linenumber">3420</div><div style="width:4em;display:inline-block"></div>callback(null,&nbsp;sessionObj);
<a name="line3421"></a><div class="linenumber">3421</div><div style="width:2em;display:inline-block"></div>};
<a name="line3422"></a><div class="linenumber">3422</div><div style="width:0em;display:inline-block"></div>
<a name="line3423"></a><div class="linenumber">3423</div><div style="width:2em;display:inline-block"></div>callback(null,&nbsp;appObj);
<a name="line3424"></a><div class="linenumber">3424</div><div style="width:0em;display:inline-block"></div>};
<a name="line3425"></a><div class="linenumber">3425</div><div style="width:0em;display:inline-block"></div>
<a name="line3426"></a><div class="linenumber">3426</div><div style="width:0em;display:inline-block"></div>
<a name="line3427"></a><div class="linenumber">3427</div><div style="width:0em;display:inline-block"></div>//&nbsp;Documenting&nbsp;global&nbsp;callbacks
<a name="line3428"></a><div class="linenumber">3428</div><div style="width:0em;display:inline-block"></div>/**
<a name="line3429"></a><div class="linenumber">3429</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;next&nbsp;callback&nbsp;is&nbsp;called&nbsp;upon&nbsp;completion&nbsp;of&nbsp;a&nbsp;method.&nbsp;If&nbsp;the&nbsp;`err`&nbsp;parameter&nbsp;is&nbsp;null,&nbsp;than&nbsp;the&nbsp;method&nbsp;completed&nbsp;successfully.
<a name="line3430"></a><div class="linenumber">3430</div><div style="width:0em;display:inline-block"></div>*
<a name="line3431"></a><div class="linenumber">3431</div><div style="width:0em;display:inline-block"></div>*&nbsp;@callback&nbsp;nextCallback
<a name="line3432"></a><div class="linenumber">3432</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;{?Error}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;err&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Optional&nbsp;Error&nbsp;object.&nbsp;If&nbsp;it&nbsp;is&nbsp;null,&nbsp;than&nbsp;assume&nbsp;no&nbsp;error&nbsp;has&nbsp;occurred.
<a name="line3433"></a><div class="linenumber">3433</div><div style="width:0em;display:inline-block"></div>*/
<a name="line3434"></a><div class="linenumber">3434</div><div style="width:0em;display:inline-block"></div>
<a name="line3435"></a><div class="linenumber">3435</div><div style="width:0em;display:inline-block"></div>
<a name="line3436"></a><div class="linenumber">3436</div><div style="width:0em;display:inline-block"></div>/**
<a name="line3437"></a><div class="linenumber">3437</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;application&nbsp;callback&nbsp;is&nbsp;called&nbsp;upon&nbsp;completion&nbsp;of&nbsp;a&nbsp;method&nbsp;which&nbsp;is&nbsp;meant&nbsp;to&nbsp;deliver&nbsp;an&nbsp;application&nbsp;object.&nbsp;If&nbsp;the&nbsp;`err`&nbsp;parameter&nbsp;is&nbsp;null,&nbsp;than&nbsp;the&nbsp;method&nbsp;completed&nbsp;successfully.
<a name="line3438"></a><div class="linenumber">3438</div><div style="width:0em;display:inline-block"></div>*
<a name="line3439"></a><div class="linenumber">3439</div><div style="width:0em;display:inline-block"></div>*&nbsp;@callback&nbsp;appCallback
<a name="line3440"></a><div class="linenumber">3440</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;{?Error}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;err&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;object.&nbsp;If&nbsp;it&nbsp;is&nbsp;null,&nbsp;than&nbsp;assume&nbsp;no&nbsp;error&nbsp;has&nbsp;occurred.
<a name="line3441"></a><div class="linenumber">3441</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;{?Object}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;appObj&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Application&nbsp;object.&nbsp;Will&nbsp;be&nbsp;null&nbsp;if&nbsp;an&nbsp;error&nbsp;has&nbsp;occurred.
<a name="line3442"></a><div class="linenumber">3442</div><div style="width:0em;display:inline-block"></div>*/
<a name="line3443"></a><div class="linenumber">3443</div><div style="width:0em;display:inline-block"></div>
<a name="line3444"></a><div class="linenumber">3444</div><div style="width:0em;display:inline-block"></div>
<a name="line3445"></a><div class="linenumber">3445</div><div style="width:0em;display:inline-block"></div>/**
<a name="line3446"></a><div class="linenumber">3446</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;connection&nbsp;callback&nbsp;is&nbsp;called&nbsp;upon&nbsp;completion&nbsp;of&nbsp;a&nbsp;method&nbsp;which&nbsp;is&nbsp;meant&nbsp;to&nbsp;deliver&nbsp;a&nbsp;connection&nbsp;object.&nbsp;If&nbsp;the&nbsp;`err`&nbsp;parameter&nbsp;is&nbsp;null,&nbsp;than&nbsp;the&nbsp;method&nbsp;completed&nbsp;successfully.
<a name="line3447"></a><div class="linenumber">3447</div><div style="width:0em;display:inline-block"></div>*
<a name="line3448"></a><div class="linenumber">3448</div><div style="width:0em;display:inline-block"></div>*&nbsp;@callback&nbsp;connectionCallback
<a name="line3449"></a><div class="linenumber">3449</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;{?Error}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;err&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;object.&nbsp;If&nbsp;it&nbsp;is&nbsp;null,&nbsp;than&nbsp;assume&nbsp;no&nbsp;error&nbsp;has&nbsp;occurred.
<a name="line3450"></a><div class="linenumber">3450</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;{?Object}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connectionObj&nbsp;Connection&nbsp;object.&nbsp;Will&nbsp;be&nbsp;null&nbsp;if&nbsp;an&nbsp;error&nbsp;has&nbsp;occurred.
<a name="line3451"></a><div class="linenumber">3451</div><div style="width:0em;display:inline-block"></div>*/
<a name="line3452"></a><div class="linenumber">3452</div><div style="width:0em;display:inline-block"></div>
<a name="line3453"></a><div class="linenumber">3453</div><div style="width:0em;display:inline-block"></div>
<a name="line3454"></a><div class="linenumber">3454</div><div style="width:0em;display:inline-block"></div>/**
<a name="line3455"></a><div class="linenumber">3455</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;room&nbsp;callback&nbsp;is&nbsp;called&nbsp;upon&nbsp;completion&nbsp;of&nbsp;a&nbsp;method&nbsp;which&nbsp;is&nbsp;meant&nbsp;to&nbsp;deliver&nbsp;a&nbsp;room&nbsp;object.&nbsp;If&nbsp;the&nbsp;`err`&nbsp;parameter&nbsp;is&nbsp;null,&nbsp;than&nbsp;the&nbsp;method&nbsp;completed&nbsp;successfully.
<a name="line3456"></a><div class="linenumber">3456</div><div style="width:0em;display:inline-block"></div>*
<a name="line3457"></a><div class="linenumber">3457</div><div style="width:0em;display:inline-block"></div>*&nbsp;@callback&nbsp;roomCallback
<a name="line3458"></a><div class="linenumber">3458</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;{?Error}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;err&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error&nbsp;object.&nbsp;If&nbsp;it&nbsp;is&nbsp;null,&nbsp;than&nbsp;assume&nbsp;no&nbsp;error&nbsp;has&nbsp;occurred.
<a name="line3459"></a><div class="linenumber">3459</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;{?Object}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;roomObj&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;object.&nbsp;Will&nbsp;be&nbsp;null&nbsp;if&nbsp;an&nbsp;error&nbsp;has&nbsp;occurred.
<a name="line3460"></a><div class="linenumber">3460</div><div style="width:0em;display:inline-block"></div>*/
<a name="line3461"></a><div class="linenumber">3461</div><div style="width:0em;display:inline-block"></div>
<a name="line3462"></a><div class="linenumber">3462</div><div style="width:0em;display:inline-block"></div>//&nbsp;Documenting&nbsp;Custom&nbsp;Type-Definitions
<a name="line3463"></a><div class="linenumber">3463</div><div style="width:0em;display:inline-block"></div>/**
<a name="line3464"></a><div class="linenumber">3464</div><div style="width:0em;display:inline-block"></div>*&nbsp;An&nbsp;error&nbsp;object
<a name="line3465"></a><div class="linenumber">3465</div><div style="width:0em;display:inline-block"></div>*
<a name="line3466"></a><div class="linenumber">3466</div><div style="width:0em;display:inline-block"></div>*&nbsp;@typedef&nbsp;{Object}&nbsp;Error
<a name="line3467"></a><div class="linenumber">3467</div><div style="width:0em;display:inline-block"></div>*/
<a name="line3468"></a><div class="linenumber">3468</div><div style="width:0em;display:inline-block"></div>
<a name="line3469"></a><div class="linenumber">3469</div><div style="width:0em;display:inline-block"></div>//&nbsp;Running&nbsp;the&nbsp;default&nbsp;listeners&nbsp;to&nbsp;initialize&nbsp;the&nbsp;events
<a name="line3470"></a><div class="linenumber">3470</div><div style="width:0em;display:inline-block"></div>pub.events.setDefaultListeners();
</code></pre>
</article>
</section>
</div>
		
	</div>
</div>
<footer class="template">
	<div class="wrapper-content">
		<p>Copyright &copy;2016 EasyRTC</p>
	</div>
</footer>
<!-- <script>prettyPrint();</script> -->
<!-- <script src="scripts/linenumber.js"></script> -->
</body>
</html>